This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting ip address

 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic