• 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

InetAddress

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need help in resolving IP address of a supplied server name. Currently, the application is using InetAddress.getHostAddress() to extract IP address from provided server name.
The problem here is this returns the private IP address of the server name. If I need the public IP address, then what should I use?
Thanks,
Shaili
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am not absolutly sure about that. But the java classes simply use the operating systems host resolving method. (hosts file, DNS etc.).
so it will always give you the same ip like e.g.
# ping your.host
If you want to have a different ip to be retrieved just change the names
config.
 
reply
    Bookmark Topic Watch Topic
  • New Topic