aspose file tools
The moose likes Servlets and the fly likes getting client IP address Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "getting client IP address" Watch "getting client IP address" New topic
Author

getting client IP address

sitaram irrinki
Ranch Hand

Joined: Feb 16, 2005
Posts: 158
while accessing client IP address we should use the fllowing method,

String addr = request.getRemoteAddr();
System.out.println(addr);

If the client uses Proxy server then the sever gets the proxy IP Address, How can server gets exact IP number(Not Proxy).

Ex: The IP address of the system is 172.16.0.113, the proxy IP number is 172.16.0.200. when we the above methos we are getting 172.16.0.200, but we need 172.16.0.113.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17234
    
    1

Um, but isn't that the purpose of the Proxy, for protection. You wouldn't be able to get to the IP address of the machine directly anyway, you would always have to go through the proxy.

If you were able to get through then you could do some major damage to those personal machines, which wouldn't be good press for Java.

Or I could be wrong.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 471
I think it's quite impossible, unless you have an applet on client side, which can send you exact IP. For example my IP inside company 10.10.10.xx based, but all web sites report it as 192 something based.


Get power of your iPod with MediaChest | Minimal J2EE container is here | Light weight full J2EE stack | My blog | Co-author of "Windows programming in Turbo Pascal"
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: getting client IP address
 
Similar Threads
Traceroute hinkyness.
client IP address
Returning the users IP address
Read Client IP Address behind Proxy
regarding proxy configuration