diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceInternal/Network.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java new file mode 100644 index 00000000000..67bc6733953 --- /dev/null +++ b/java/src/IceInternal/Network.java @@ -0,0 +1,38 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +package IceInternal; + +public final class Network +{ + public static String + getLocalHost(boolean numeric) + { + String host; + + try + { + if (!numeric) + { + host = java.net.InetAddress.getLocalHost().getHostName(); + } + else + { + host = java.net.InetAddress.getLocalHost().getHostAddress(); + } + } + catch(java.net.UnknownHostException ex) + { + throw new Ice.DNSException(); + } + + return host; + } +} |