• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

get IP, but not 127.0.0.1

 
Ranch Hand
Posts: 430
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 430
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy!

I could solve my problem.

 
Ranch Hand
Posts: 67
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also iterate over the network interfaces in Java. For example:

 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic