aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes How to get DNS name and IP Address with Java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply locked New topic
Author

How to get DNS name and IP Address with Java code

SP Nam
Ranch Hand

Joined: Oct 15, 2003
Posts: 41
How can I get my DNS servername and IPAddress, by just running a java program from command prompt, code help please
Vinod Chandana
Ranch Hand

Joined: Aug 26, 2003
Posts: 59
Try InetAddress.getLocalHost().getHostName() and InetAddress.getLocalHost().getHostAddress(). This will give u both name and the address of the localhost. Hope this helps. If not give me a message.
Vinod.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

I'm closing this thread, as it's a duplicate of this one, where the question has already been answered. Please post followups there.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get DNS name and IP Address with Java code