summaryrefslogtreecommitdiff
path: root/ACE/ace/SOCK_Acceptor.cpp
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2013-12-12 00:22:03 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2013-12-12 00:22:03 +0000
commit629de156bd72d4cedc2568668864ad43a1dae88c (patch)
tree4d9cd0bca272856064f7344ddbdee0202eecda5e /ACE/ace/SOCK_Acceptor.cpp
parentd37ca582bb1ebe447aefa89b7898d08dbf2f9502 (diff)
downloadATCD-629de156bd72d4cedc2568668864ad43a1dae88c.tar.gz
Thu Dec 12 00:07:09 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
* ace/SOCK_Acceptor.cpp: In order for Windows Vista and newer IPV6 sockets to also accept IPv4 traffic, the socket must be explicitly set to "dual stack mode" prior to binding it to an address. Since this is making windows deployments exhibit behavior consistent with other platforms, this is always done. We can add an option later if necessary.
Diffstat (limited to 'ACE/ace/SOCK_Acceptor.cpp')
-rw-r--r--ACE/ace/SOCK_Acceptor.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/ACE/ace/SOCK_Acceptor.cpp b/ACE/ace/SOCK_Acceptor.cpp
index 9128232fed2..c0e4ab174ce 100644
--- a/ACE/ace/SOCK_Acceptor.cpp
+++ b/ACE/ace/SOCK_Acceptor.cpp
@@ -242,6 +242,19 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
else
local_inet6_addr = *reinterpret_cast<sockaddr_in6 *> (local_sap.get_addr ());
+# if defined (ACE_WIN32)
+ // on windows vista and later, Winsock can support dual stack sockets
+ // but this must be explicitly set prior to the bind. Since this
+ // behavior is the default on *nix platforms, it should be benigh to
+ // just do it here. On older platforms the setsockopt will fail, but
+ // that should be OK.
+ int zero = 0;
+ ACE_OS::setsockopt (this->get_handle (),
+ IPPROTO_IPV6,
+ IPV6_V6ONLY,
+ (char *)&zero,
+ sizeof (zero));
+# endif /* ACE_WIN32 */
// We probably don't need a bind_port written here.
// There are currently no supported OS's that define
// ACE_LACKS_WILDCARD_BIND.