summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/demo/Ice/multicast/config.client13
-rw-r--r--cpp/demo/Ice/multicast/config.server13
-rw-r--r--cpp/src/Ice/Network.cpp4
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp2
4 files changed, 17 insertions, 15 deletions
diff --git a/cpp/demo/Ice/multicast/config.client b/cpp/demo/Ice/multicast/config.client
index b68bb269f33..06e85aed076 100644
--- a/cpp/demo/Ice/multicast/config.client
+++ b/cpp/demo/Ice/multicast/config.client
@@ -5,12 +5,6 @@
Discover.Proxy=discover:udp -h 224.0.0.5 -p 10000
#
-# Alternative IPv6 configuration
-#
-#Ice.IPv6=1
-#Discover.Proxy=discover:udp -h "ff01::1:1" -p 10000
-
-#
# The client creates an object adapter with the name
# "DiscoverReply". The following line sets the endpoints for this
# adapter.
@@ -18,6 +12,13 @@ Discover.Proxy=discover:udp -h 224.0.0.5 -p 10000
DiscoverReply.Endpoints=tcp
#
+# Alternative IPv6 configuration
+#
+#Ice.IPv6=1
+#Discover.Proxy=discover:udp -h "ff01::1:1" -p 10000
+#DiscoverReply.Endpoints=tcp -h "::1"
+
+#
# Warn about connection exceptions
#
Ice.Warn.Connections=1
diff --git a/cpp/demo/Ice/multicast/config.server b/cpp/demo/Ice/multicast/config.server
index 451f9e5d5a5..850d1832f2e 100644
--- a/cpp/demo/Ice/multicast/config.server
+++ b/cpp/demo/Ice/multicast/config.server
@@ -5,18 +5,19 @@
Discover.Endpoints=udp -h 224.0.0.5 -p 10000
#
-# Alternative IPv6 configuration
-#
-#Ice.IPv6=1
-#Discover.Endpoints=udp -h "ff01::1:1" -p 10000
-
-#
# The server creates an object adapter with the name "Hello". The
# following line sets the endpoints for this adapter.
#
Hello.Endpoints=tcp
#
+# Alternative IPv6 configuration
+#
+#Ice.IPv6=1
+#Discover.Endpoints=udp -h "ff01::1:1" -p 10000
+#Hello.Endpoints=tcp -h "::1"
+
+#
# Warn about connection exceptions
#
Ice.Warn.Connections=1
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);