GeeCON Prague 2014*
The moose likes Portals and Portlets and the fly likes How to i get IP address of the Remote system Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "How to i get IP address of the Remote system" Watch "How to i get IP address of the Remote system" New topic
Author

How to i get IP address of the Remote system

Nag
Greenhorn

Joined: Apr 06, 2005
Posts: 5
Hi I have chat application.Based on my chat application,I want ot know the Which Browser,City,State and operating system of the customer.

Can soem one can help on this .

Thanks in advance

This is kind og urgent
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
The Servlet API provides a way to get the client IP address http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getRemoteAddr(). To get the geographic location of the client there are some tools available, just try Google to find some.


My Blog
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

You can often determine the type of browser from the User-Agent header in the request. Although people can and do forge that header to pretend that their code is a browser.
Gopikrishna Madishetti
Greenhorn

Joined: Sep 30, 2008
Posts: 10
Request.getIPAddress() -- Returns A string containing the IP address of the client making the request.

response.write("IP Address: " + Request.getIPAddress());
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Originally posted by krishna Madishetti:
Request.getIPAddress() -- Returns A string containing the IP address of the client making the request.


Krishna,

Can you please provide a source where this request.getIPAddress() method is mentioned, as I never came across such a method?
Gopikrishna Madishetti
Greenhorn

Joined: Sep 30, 2008
Posts: 10
please find related artical using below link

http://support.dataweb.com/Help/default.view?Topic=objectmodel/request/request_getipaddress

thanks
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Thats not a standard Java API.
Gopikrishna Madishetti
Greenhorn

Joined: Sep 30, 2008
Posts: 10
yeah...you are right...
sorry for mis-information.
I think this is the correct way to get the remote ip address..
request.getRemoteAddr();
please let me know If I am wrong.
Thanks,
Krishna.
Soumik Basu
Ranch Hand

Joined: Oct 01, 2007
Posts: 40
i think the correct method is:
request.getRemoteUser();
Gopikrishna Madishetti
Greenhorn

Joined: Sep 30, 2008
Posts: 10
1) Interface HttpServletRequest,
getRemoteUser() -
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.

2) Interface ServletRequest,
getRemoteAddr() -
Returns the Internet Protocol (IP) address of the client that sent the request.

Thanks.
 
GeeCON Prague 2014
 
subject: How to i get IP address of the Remote system