I have a local IP address in dotted decimal notation in a String
. I want to convert it to an InetAddress
to feed it to Socket
, but I need to do it without doing a DNS lookup (because this might cause lengthy timeouts).
Is there a ready method for that, or do I need to split the String
and create the InetAddress
from its bytes?
Update The factory methods InetAddress.getByName()
and InetAddress.getByAddress()
don't seem to be a good fit, as they both also accept hostnames such as java.sun.com
. There is no saying if they will try to contact a DNS server in their implementation.