]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 849212 ] Sets SO_REUSEADDR flag on server sockets
authorJulian Smart <julian@anthemion.co.uk>
Sun, 11 Jan 2004 16:54:39 +0000 (16:54 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 11 Jan 2004 16:54:39 +0000 (16:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25128 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/gsocket.c
src/unix/gsocket.c

index b4156f5afead4d8cef10d522b47ac46dde9b62b9..9eb8d695138a1d2882960db67ce807148f5f73cf 100644 (file)
@@ -376,6 +376,11 @@ GSocketError GSocket_SetServer(GSocket *sck)
   ioctlsocket(sck->m_fd, FIONBIO, (u_long FAR *) &arg);
   _GSocket_Enable_Events(sck);
 
+  /* allow a socket to re-bind if the socket is in the TIME_WAIT
+     state after being previously closed.
+   */
+  setsockopt(sck->m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(u_long));
+
   /* Bind to the local address,
    * retrieve the actual address bound,
    * and listen up to 5 connections.
index c7b0d7cf492011b99efbe4e082b27787d16f489c..396a93641dac7a85b999f239d6b0043c74e4be55 100644 (file)
@@ -488,6 +488,11 @@ GSocketError GSocket_SetServer(GSocket *sck)
 #endif
   _GSocket_Enable_Events(sck);
 
+  /* allow a socket to re-bind if the socket is in the TIME_WAIT
+     state after being previously closed.
+   */
+  setsockopt(sck->m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(u_long));
+
   /* Bind to the local address,
    * retrieve the actual address bound,
    * and listen up to 5 connections.