wood burning stoves 2.0*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply locked New topic

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.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

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]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: How to get DNS name and IP Address with Java code
Similar Threads
DNS Verification
How to make DNS
Server Instructions...
Enum and DNS for VPIM (Voice Profile for Internet Mail)
How to get DNS IP Address