diff options
Diffstat (limited to 'cpp/src/Ice/UdpTransceiver.cpp')
-rw-r--r-- | cpp/src/Ice/UdpTransceiver.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index 92852685aea..39185606ece 100644 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -341,12 +341,12 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s _logger(instance->initializationData().logger), _stats(instance->initializationData().stats), _incoming(true), + _addr(getAddressForServer(host, port, instance->protocolSupport())), _connect(connect), _warn(instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Datagrams") > 0) { try { - getAddressForServer(host, port, _addr, instance->protocolSupport()); _fd = createSocket(true, _addr.ss_family); setBufSize(instance); setBlock(_fd, false); @@ -366,11 +366,12 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s // Windows does not allow binding to the mcast address itself // so we bind to INADDR_ANY (0.0.0.0) instead. // - getAddressForServer("", getPort(_mcastAddr), _addr, - _mcastAddr.ss_family == AF_INET ? EnableIPv4 : EnableIPv6); + const_cast<struct sockaddr_storage&>(_addr) = + getAddressForServer("", getPort(_mcastAddr), + _mcastAddr.ss_family == AF_INET ? EnableIPv4 : EnableIPv6); #endif - doBind(_fd, _addr); + const_cast<struct sockaddr_storage&>(_addr) = doBind(_fd, _addr); setMcastGroup(_fd, _mcastAddr, mcastInterface); } else @@ -390,7 +391,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s // setReuseAddress(_fd, true); #endif - doBind(_fd, _addr); + const_cast<struct sockaddr_storage&>(_addr) = doBind(_fd, _addr); // AF_UNSPEC means not multicast. _mcastAddr.ss_family = AF_UNSPEC; |