File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting ip address

 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone.

How can I access a computer's ip address or computer name in java or jsp?

I tried getRemoteAddr() but it returns the loopback address 127.0.0.0 and getRemoteHost also returns localhost/or the server name.

i want to get the ip address of the pc trying to access the server and not the address of the server itself

thanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getRemoteAddr() and getRemoteHost() really should work - to an extent... These calls will return the IP/host of the client, or the last proxy before they hit the web page. Is it possible that there's something that could act as a "proxy" on your server before the client hits the web page?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic