I have the following little code snippet:
InetAddress address = InetAddress.getByName(host); if(address.isReachable(TIMEOUT_IN_MILLISECONDS))
toString() seems to be faster:
toString()
given an InetAddress ia or InterfaceAddress ia,
System.out.println ( ia.toString() ) will show a string containing your ipAddress faster than ia.getHostName()
System.out.println ( ia.toString() )
ia.getHostName()
You can then use ia.toString().substring to extract it.
ia.toString().substring
I don't know why.