Bookmark Topic Watch Topic
  • New Topic

How to get DNS name and IP Address with Java code

 
SP Nam
Ranch Hand
Posts: 41
  • 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
  • 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: 24208
35
Chrome Eclipse IDE Mac OS X
  • 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.
 
    Bookmark Topic Watch Topic
  • New Topic