fixed SO_REUSEADDR WIN32 strangeness
This commit is contained in:
@@ -40,16 +40,14 @@ casIntfIO::casIntfIO (const caNetAddr &addrIn) :
|
||||
throw S_cas_noFD;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allows immediate reuse of the port in case we exit early
|
||||
*
|
||||
/*
|
||||
* Note: WINSOCK appears to assign a different functionality for
|
||||
* SO_REUSEADDR compared to other OS. With WINSOCK SO_REUSEADDR indicates
|
||||
* that other servers can bind to the same TCP port on the same host!
|
||||
* SO_REUSEADDR compared to other OS. With WINSOCK SO_REUSEADDR indicates
|
||||
* that simultaneously servers can bind to the same TCP port on the same host!
|
||||
* Also, servers are always enabled to reuse a port immediately after
|
||||
* they exit.
|
||||
*/
|
||||
# ifndef SO_REUSEADDR_DOES_NOT_RELEASE_TCP_PORT
|
||||
* they exit ( even if SO_REUSEADDR isnt set ).
|
||||
*/
|
||||
# ifndef SO_REUSEADDR_ALLOWS_SIMULTANEOUS_TCP_SERVERS_TO_USE_SAME_PORT
|
||||
status = setsockopt (
|
||||
this->sock,
|
||||
SOL_SOCKET,
|
||||
|
||||
@@ -312,7 +312,14 @@ LOCAL int req_server (void)
|
||||
threadSuspendSelf ();
|
||||
}
|
||||
|
||||
# ifndef SO_REUSEADDR_DOES_NOT_RELEASE_TCP_PORT
|
||||
/*
|
||||
* Note: WINSOCK appears to assign a different functionality for
|
||||
* SO_REUSEADDR compared to other OS. With WINSOCK SO_REUSEADDR indicates
|
||||
* that simultaneously servers can bind to the same TCP port on the same host!
|
||||
* Also, servers are always enabled to reuse a port immediately after
|
||||
* they exit ( even if SO_REUSEADDR isnt set ).
|
||||
*/
|
||||
# ifndef SO_REUSEADDR_ALLOWS_SIMULTANEOUS_TCP_SERVERS_TO_USE_SAME_PORT
|
||||
flag = 1;
|
||||
status = setsockopt ( IOC_sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *) &flag, sizeof (flag) );
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
* .09 050494 pg HPUX port changes.
|
||||
* .10 021694 joh ANSI C
|
||||
* $Log$
|
||||
* Revision 1.39 2000/10/11 22:23:30 jhill
|
||||
* configure that WINSOCK is very different about SO_REUSEADDR
|
||||
*
|
||||
* Revision 1.38 2000/08/25 19:44:30 jhill
|
||||
* fixed Linux uses unsigned where int is used on other OS
|
||||
*
|
||||
@@ -243,7 +246,14 @@ int main()
|
||||
return IOCLS_ERROR;
|
||||
}
|
||||
|
||||
# ifndef SO_REUSEADDR_DOES_NOT_RELEASE_TCP_PORT
|
||||
/*
|
||||
* Note: WINSOCK appears to assign a different functionality for
|
||||
* SO_REUSEADDR compared to other OS. With WINSOCK SO_REUSEADDR indicates
|
||||
* that simultaneously servers can bind to the same TCP port on the same host!
|
||||
* Also, servers are always enabled to reuse a port immediately after
|
||||
* they exit ( even if SO_REUSEADDR isnt set ).
|
||||
*/
|
||||
# ifndef SO_REUSEADDR_ALLOWS_SIMULTANEOUS_TCP_SERVERS_TO_USE_SAME_PORT
|
||||
optval = TRUE;
|
||||
status = setsockopt( pserver->sock,
|
||||
SOL_SOCKET,
|
||||
|
||||
Reference in New Issue
Block a user