Package org.wso2.carbon.utils
Class NetworkUtils
- java.lang.Object
-
- org.wso2.carbon.utils.NetworkUtils
-
public final class NetworkUtils extends Object
Utility classes for networking
-
-
Field Summary
Fields Modifier and Type Field Description static StringLOCALHOSTwhat we return when we cannot determine our hostname.static StringLOCALHOST_IPV6loopback address in IPV6
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetLocalHostname()Get the string defining the hostname of the system, as taken from the default network adapter of the system.static StringgetMgtHostName()Returns the host name to be used by the Management Consolestatic voidinit(String hostName, String mgtHostName)
-
-
-
Field Detail
-
LOCALHOST
public static final String LOCALHOST
what we return when we cannot determine our hostname. We use this rather than 'localhost' as if DNS is very confused, localhost can map to different machines than "self".- See Also:
- Constant Field Values
-
LOCALHOST_IPV6
public static final String LOCALHOST_IPV6
loopback address in IPV6- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init(String hostName, String mgtHostName) throws SocketException
- Throws:
SocketException
-
getLocalHostname
public static String getLocalHostname() throws SocketException
Get the string defining the hostname of the system, as taken from the default network adapter of the system. There is no guarantee that this will be fully qualified, or that it is the hostname used by external machines to access the server. If we cannot determine the name, then we return the default hostname, which is defined byLOCALHOST- Returns:
- a string name of the host.
- Throws:
SocketException
-
getMgtHostName
public static String getMgtHostName()
Returns the host name to be used by the Management Console- Returns:
- host name to be used by the Management Console
-
-