wood burning stoves 2.0*
The moose likes JSP and the fly likes getting ip address Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "getting ip address" Watch "getting ip address" New topic
Author

getting ip address

Bernard Sigmund Gustav
Ranch Hand

Joined: Dec 20, 2005
Posts: 170
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

Joined: Oct 18, 2000
Posts: 4121

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?


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting ip address