diff options
author | phintuka <phintuka> | 2006-07-21 22:53:47 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2006-07-21 22:53:47 +0000 |
commit | 3e0ff4360e9b7613fe94f44affc259d574af65e5 (patch) | |
tree | 47e08f0e6273d43067bb6956b80eb29defafda24 | |
parent | 151d1c9992c13b9e1670a7517b9a93b0e93a5c00 (diff) | |
download | xineliboutput-3e0ff4360e9b7613fe94f44affc259d574af65e5.tar.gz xineliboutput-3e0ff4360e9b7613fe94f44affc259d574af65e5.tar.bz2 |
SO_REUSEADDR added to UDP data sockets
-rw-r--r-- | tools/cxsocket.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/cxsocket.h b/tools/cxsocket.h index 0e716e4e..f37aabc3 100644 --- a/tools/cxsocket.h +++ b/tools/cxsocket.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: cxsocket.h,v 1.5 2006-07-07 05:28:04 phintuka Exp $ + * $Id: cxsocket.h,v 1.6 2006-07-21 22:53:47 phintuka Exp $ * */ @@ -81,7 +81,7 @@ static inline int sock_connect(int fd_control, int port, int type) { struct sockaddr_in sin; socklen_t len = sizeof(sin); - int s; + int s, one = 1; if(getpeername(fd_control, (struct sockaddr *)&sin, &len)) { LOGERR("sock_connect: getpeername failed"); @@ -108,6 +108,9 @@ static inline int sock_connect(int fd_control, int port, int type) // Set socket buffers: large send buffer, small receive buffer set_socket_buffers(s, KILOBYTE(256), 2048); + if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int)) < 0) + LOGERR("sock_connect: setsockopt(SO_REUSEADDR) failed"); + sin.sin_family = AF_INET; sin.sin_port = htons(port); |