summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2009-02-13 15:37:18 -0330
committerDwayne Boone <dwayne@zeroc.com>2009-02-13 15:37:18 -0330
commit75894dc2b850fb8ecaaa8e534aafa9e0557e4078 (patch)
tree9941edf3b7e2b42d29707a9de22f9fdf08b5ba50 /cpp/src
parentbug 3531 - fixing Eclipse warnings in Java code (diff)
downloadice-75894dc2b850fb8ecaaa8e534aafa9e0557e4078.tar.bz2
ice-75894dc2b850fb8ecaaa8e534aafa9e0557e4078.tar.xz
ice-75894dc2b850fb8ecaaa8e534aafa9e0557e4078.zip
Bug 3222 - show correct mcast port in tracing if not set on Windows
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 9eee012ff94..3c180e25031 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -353,18 +353,33 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
if(isMulticast(_addr))
{
setReuseAddress(_fd, true);
- _mcastAddr = _addr;
#ifdef _WIN32
//
// Windows does not allow binding to the mcast address itself
// so we bind to INADDR_ANY (0.0.0.0) instead.
//
+ _mcastAddr = _addr;
getAddressForServer("", getPort(_mcastAddr), _addr,
_mcastAddr.ss_family == AF_INET ? EnableIPv4 : EnableIPv6);
-#endif
+ doBind(_fd, _addr);
+ if(getPort(_mcastAddr) == 0)
+ {
+ int port = getPort(_addr);
+ if(_mcastAddr.ss_family == AF_INET)
+ {
+ reinterpret_cast<sockaddr_in*>(&_mcastAddr)->sin_port = htons(port);
+ }
+ else
+ {
+ reinterpret_cast<sockaddr_in6*>(&_mcastAddr)->sin6_port = htons(port);
+ }
+ }
+#else
doBind(_fd, _addr);
+ _mcastAddr = _addr;
+#endif
setMcastGroup(_fd, _mcastAddr, mcastInterface);
}
else