From 3e0ff4360e9b7613fe94f44affc259d574af65e5 Mon Sep 17 00:00:00 2001 From: phintuka Date: Fri, 21 Jul 2006 22:53:47 +0000 Subject: SO_REUSEADDR added to UDP data sockets --- tools/cxsocket.h | 7 +++++-- 1 file 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); -- cgit v1.2.3