In my program a user enters a url string, say
http://www.engineering.uiowa.edu/~hawkeng//fall01/graphics/potato.gif
how would I get the IP address of this url? I tried using
InetAddress address = InetAddress.getByName(urlStr);
but the result always comes back null. What is the proper way to get the IP address?
You need to give
hostname
to getByName() method and it returnsOutput =
www.engineering.uiowa.edu/128.255.17.182
To get the
IP address
Try this:
To get the raw IP: