*
The moose likes Java in General and the fly likes InetAddress Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "InetAddress" Watch "InetAddress" New topic
Author

InetAddress

Shaili Suri
Greenhorn

Joined: Dec 12, 2003
Posts: 2
Hi,
I need help in resolving IP address of a supplied server name. Currently, the application is using InetAddress.getHostAddress() to extract IP address from provided server name.
The problem here is this returns the private IP address of the server name. If I need the public IP address, then what should I use?
Thanks,
Shaili
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
i am not absolutly sure about that. But the java classes simply use the operating systems host resolving method. (hosts file, DNS etc.).
so it will always give you the same ip like e.g.
# ping your.host
If you want to have a different ip to be retrieved just change the names
config.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: InetAddress