summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/Network.java
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-06-13 14:04:24 -0230
committerDwayne Boone <dwayne@zeroc.com>2007-06-13 14:04:24 -0230
commitb2031b8795606b6893cb3766cc3f18f5c6c0c252 (patch)
tree79ad7a4f1c5e7866efc9547f1d4bb7354842579e /java/src/IceInternal/Network.java
parentMerge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff)
downloadice-b2031b8795606b6893cb3766cc3f18f5c6c0c252.tar.bz2
ice-b2031b8795606b6893cb3766cc3f18f5c6c0c252.tar.xz
ice-b2031b8795606b6893cb3766cc3f18f5c6c0c252.zip
Bug 1658 - fix collocation issue with endpoints listening on 0.0.0.0
Diffstat (limited to 'java/src/IceInternal/Network.java')
-rw-r--r--java/src/IceInternal/Network.java52
1 files changed, 32 insertions, 20 deletions
diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java
index 57e2b5b6867..3d929b13edd 100644
--- a/java/src/IceInternal/Network.java
+++ b/java/src/IceInternal/Network.java
@@ -791,32 +791,44 @@ public final class Network
getAddresses(String host, int port)
{
java.util.ArrayList addresses = new java.util.ArrayList();
- try
+ if(host.equals("0.0.0.0"))
{
- java.net.InetAddress[] addrs = java.net.InetAddress.getAllByName(host);
- for(int i = 0; i < addrs.length; ++i)
+ java.util.ArrayList hosts = getLocalHosts();
+ java.util.Iterator p = hosts.iterator();
+ while(p.hasNext())
{
- if(addrs[i] instanceof java.net.Inet4Address)
- {
- addresses.add(new java.net.InetSocketAddress(addrs[i], port));
- }
+ addresses.add(getAddress((String)p.next(), port));
}
}
- catch(java.net.UnknownHostException ex)
+ else
{
- Ice.DNSException e = new Ice.DNSException();
- e.host = host;
- throw e;
- }
+ try
+ {
+ java.net.InetAddress[] addrs = java.net.InetAddress.getAllByName(host);
+ for(int i = 0; i < addrs.length; ++i)
+ {
+ if(addrs[i] instanceof java.net.Inet4Address)
+ {
+ addresses.add(new java.net.InetSocketAddress(addrs[i], port));
+ }
+ }
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ Ice.DNSException e = new Ice.DNSException();
+ e.host = host;
+ throw e;
+ }
- //
- // No Inet4Address available.
- //
- if(addresses.size() == 0)
- {
- Ice.DNSException e = new Ice.DNSException();
- e.host = host;
- throw e;
+ //
+ // No Inet4Address available.
+ //
+ if(addresses.size() == 0)
+ {
+ Ice.DNSException e = new Ice.DNSException();
+ e.host = host;
+ throw e;
+ }
}
return addresses;