Thursday, June 17, 2010

Getting the hostname for the local machine

there are always the simple things which I'm getting stuck with, sometimes simple things like just getting the hostname for a local ip address in java.

solutions:



InetAddress addr = InetAddress.getLocalHost();
String hostName = addr.getCanonicalHostName();

No comments:

Post a Comment