Quantcast
Channel: Get IP address with URL string? (Java) - Stack Overflow
Browsing index pages (3 articles)

Get IP address with URL string? (Java)

In my program a user enters a url string, say http://www.engineering.uiowa.edu/~hawkeng//fall01/graphics/potato.gifhow would I get the IP address of this url? I tried usingInetAddress address =...

View Article


Answer by Victor Stafusa - BozoNaCadeia for Get IP address with URL string?...

Try this:InetAddress address = InetAddress.getByName(new URL(urlString).getHost());To get the raw IP:String ip = address.getHostAddress();

View Article


Answer by RanRag for Get IP address with URL string? (Java)

You need to give hostname to getByName() method and it returns the IP address of a host, given the host's name.URL url = new...

View Article
Browsing index pages (3 articles)


Latest Images