• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting WAN IP address from behind router

 
darren schild
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • 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!
 
Dorj Galaa
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use InetAddress.getAddress() getHostName() method
 
darren schild
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • 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();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!