From 2f7784b69f888e9a84a99a1aff8843d8841d51a2 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Mon, 22 Oct 2012 17:51:17 +0200 Subject: Fixed ICE-4556 - --interface option not working on some platforms, enabled Java IPv6 tests on Windows --- cpp/src/Ice/UdpTransceiver.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'cpp/src/Ice/UdpTransceiver.cpp') diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index 581f7527960..46e9478e91e 100644 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -870,6 +870,22 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, _mcastAddr.ss_family = AF_UNSPEC; _peerAddr.ss_family = AF_UNSPEC; // Not initialized yet. + // + // NOTE: setting the multicast interface before performing the + // connect is important for some OS such as OS X. + // + if(isMulticast(_addr)) + { + if(mcastInterface.length() > 0) + { + setMcastInterface(_fd, mcastInterface, _addr); + } + if(mcastTtl != -1) + { + setMcastTtl(_fd, mcastTtl, _addr); + } + } + // // In general, connecting a datagram socket should be non-blocking as this just setups // the default destination address for the socket. However, on some OS, connect sometime @@ -890,17 +906,6 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, }); #endif - if(isMulticast(_addr)) - { - if(mcastInterface.length() > 0) - { - setMcastInterface(_fd, mcastInterface, _addr); - } - if(mcastTtl != -1) - { - setMcastTtl(_fd, mcastTtl, _addr); - } - } #ifdef ICE_USE_IOCP // -- cgit v1.2.3