views:

306

answers:

1

I am trying to convert strings into Inetaddress. I am not trying to resolve hostnames, the strings are ipv4 addresses, does InetAddress.getByName(String host) work? Or do I have to manually parse it?

+1  A: 

Yes, that will work. The API is very clear on this ("The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address."), and of course you could easily check yourself.

Matthew Flaschen
Thanks, I looked up the api, and missed that line.
TiansHUo