Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

How to get DNS name and IP Address with Java code

 
SP Nam
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm closing this thread, as it's a duplicate of this one, where the question has already been answered. Please post followups there.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic