This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes get IP, but not 127.0.0.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Distributed Java
Bookmark "get IP, but not 127.0.0.1" Watch "get IP, but not 127.0.0.1" New topic
Author

get IP, but not 127.0.0.1

Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 423
Howdy!

How can I get IP, but not 127.0.0.1.
Thank you!

java.net.InetAddress i = java.net.InetAddress.getLocalHost();
System.out.println(i.getHostAddress());
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 423
Howdy!

I could solve my problem.

Mike Peters
Ranch Hand

Joined: Oct 10, 2009
Posts: 67

You can also iterate over the network interfaces in Java. For example:



Mike Peters
 
Have you checked out Aspose?
 
subject: get IP, but not 127.0.0.1
 
It's not a secret anymore!