summaryrefslogtreecommitdiff
path: root/ace/OS.i
diff options
context:
space:
mode:
authormichel_j <michel_j@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-04-05 17:28:54 +0000
committermichel_j <michel_j@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-04-05 17:28:54 +0000
commit50730523b34cd3732943e8acc30fdddb6c0ebfcb (patch)
tree17af726d7ab32c193f1063114de9dd42a4be042b /ace/OS.i
parent37cee1bf3de510a1f5d58640bfb72bb3f1580566 (diff)
downloadATCD-50730523b34cd3732943e8acc30fdddb6c0ebfcb.tar.gz
Fri Apr 5 11:30:00 2002 Justin Michel <michel_j@ociweb.com>
Diffstat (limited to 'ace/OS.i')
-rw-r--r--ace/OS.i20
1 files changed, 20 insertions, 0 deletions
diff --git a/ace/OS.i b/ace/OS.i
index 6d637d68a14..90cc14e83c9 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -5844,6 +5844,26 @@ ACE_OS::setsockopt (ACE_HANDLE handle,
int optlen)
{
ACE_OS_TRACE ("ACE_OS::setsockopt");
+
+ #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && defined(SO_REUSEPORT)
+ // To work around an inconsistency with Microsofts implementation of
+ // sockets, we will check for SO_REUSEADDR, and ignore it. Winsock
+ // always behaves as if SO_REUSEADDR=1. Some implementations have the
+ // same behaviour as Winsock, but use a new name for it. SO_REUSEPORT.
+ // If you want the normal behaviour for SO_REUSEADDR=0, then NT 4 sp4 and later
+ // supports SO_EXCLUSIVEADDRUSE. This also requires using an updated Platform SDK
+ // so it was decided to ignore the option for now. (Especially since ACE always
+ // sets SO_REUSEADDR=1, which we can mimic by doing nothing.)
+ if (level == SOL_SOCKET) {
+ if (optname == SO_REUSEADDR) {
+ return 0; // Not supported by Winsock
+ }
+ if (optname == SO_REUSEPORT) {
+ optname = SO_REUSEADDR;
+ }
+ }
+ #endif /*ACE_HAS_WINSOCK2*/
+
ACE_SOCKCALL_RETURN (::setsockopt ((ACE_SOCKET) handle,
level,
optname,