You should be able to use getByName or getByAddress.
The host name can be a machine name, for example "java.sun.com", or a text representation of its IP address
InetAddress addr = InetAddress.getByName("127.0.0.1");
A method that accepts a byte array can be used as follows:
byte[] ipAddr = new byte[]{127, 0, 0, 1}; InetAddress addr = InetAddress.getByAddress(ipAddr);
Bala R Apr 19 '11 at 16:24 2011-04-19 16:24
source share