• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting WAN IP address from behind router

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to get my WAN IP address through a machine on the network. But I am having no luck!
Is there a way to do it in java? Maybe another language (would much rather use java if possible)?
All I can retrieve is the host name and internal IP?!?
skiws02
192.168.1.104
Any help would be much appreciated!
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use InetAddress.getAddress() getHostName() method
 
darren schild
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For whatever reason it will only give me the internal IP and machine name?
It may have something to do with my router, but using a perl program I can get the external IP. I'm still holding out hope I can figure it out in java...
here is some of the code:
InetAddress.getLocalHost().getHostName();
InetAddress.getByName(hostName);
InetAddress.getAllByName(hostName);
hostAddress.getAddress();
getHostAddress();
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic