Thursday, March 1, 2012

Getting host name and ip-address in java

InetAddress inetAddress = InetAddress.getLocalHost();
String canonicalHostName = inetAddress.getCanonicalHostName();
String hostName = inetAddress.getHostAddress();
String ipAddress = inetAddress.getHostName();

No comments:

Post a Comment