I have the following little code snippet:
InetAddress address = InetAddress.getByName(host);
if(address.isReachable(TIMEOUT_IN_MILLISECONDS)) {
System.out.println(host + " is reachable.");
String hostName = address.getHostName();
System.out.println(hostName);
}
The getHostName() method is taking quite some time to execute if a machine has been found. Could someone please explain why?