diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/Network.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/UdpTransceiver.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index b2665c3e67b..a0daca02526 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -350,11 +350,11 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot } memcpy(&addr, info->ai_addr, info->ai_addrlen); - if(info->ai_family != PF_INET) + if(info->ai_family == PF_INET) { reinterpret_cast<sockaddr_in*>(&addr)->sin_port = htons(port); } - else if(info->ai_family != AF_INET6) + else if(info->ai_family == PF_INET6) { reinterpret_cast<sockaddr_in6*>(&addr)->sin6_port = htons(port); } diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index b852bea65ff..f6e81a83bfc 100644 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -379,7 +379,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s // so we bind to INADDR_ANY (0.0.0.0) instead. // struct sockaddr_storage addr; - getAddressForServer("", port, addr, instance->protocolSupport()); + getAddressForServer("", port, addr, _addr.ss_family == AF_INET ? EnableIPv4 : EnableIPv6); doBind(_fd, addr); #else doBind(_fd, _addr); |