Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to get client browser's ip address

Reply
Thread Tools

How to get client browser's ip address

 
 
Eqbal Z
Guest
Posts: n/a
 
      06-07-2004
Hi,

How do I get a client browser's ip address that is accessing a JSP page?
 
Reply With Quote
 
 
 
 
Luca Paganelli
Guest
Posts: n/a
 
      06-07-2004
I don't have the documentation at hand actually
but I remember there's a method of HttpServletRequest
like getRemoteHost().

So from your JSP page you can simply call
> request.getRemoteHost()

as "request" object is automatically given by J2EE framework!

--
Luca Paganelli
ICQ# 52629494


 
Reply With Quote
 
 
 
 
Grant Wagner
Guest
Posts: n/a
 
      06-11-2004
Luca Paganelli wrote:

> I don't have the documentation at hand actually
> but I remember there's a method of HttpServletRequest
> like getRemoteHost().
>
> So from your JSP page you can simply call
> > request.getRemoteHost()

> as "request" object is automatically given by J2EE framework!


Nitpick: that does _not_ give you the IP address of "client's
browser", since the client's browser has no IP address associated
with it.

More to the point: It does _not_ give you the IP address of the
"user agent's host connecting to the server for that request". It
gives you the IP address of the "host connecting to the server
for that request". Sometimes those two values (the IP address of
the user agent's host and the host connecting to the server) are
the same. Very often they are not.

You will not be able to uniquely identify the IP address of any
user agent's host if that user agent is visiting your server
through a proxy, or from behind NAT.

When I connect to a Web site from home, REMOTE_ADDR does not
report the IP address of the host running my user agent
(192.168.0.192), nor does it show the external IP address
assigned by my ISP. When I connect to a Web site from home,
REMOTE_ADDR returns my ISP's proxy server.

--
| Grant Wagner <(E-Mail Removed)>

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      06-11-2004
On Fri, 11 Jun 2004 17:56:36 GMT, Grant Wagner
<(E-Mail Removed)> wrote or quoted :

>
>Nitpick: that does _not_ give you the IP address of "client's
>browser", since the client's browser has no IP address associated
>with it.



see http://mindprod.com/jgloss/ip.html
on how to get a face ip vs the machine ip.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW TO GET THE CLIENT MACHINE ADDRESS USING APPLET gorubhasin@gmail.com Java 1 06-03-2006 06:22 PM
How to get client's IP address in the threaded case ofSimpleXMLRPCServer? Eirikur Hallgrimsson Python 0 05-05-2006 09:02 PM
Problem: GET/POST/ViewState and swapping CLIENT IP address in one session Tony ASP .Net 1 03-31-2006 04:24 PM
Re: Get Client IP Address adnan boz ASP .Net 2 06-11-2004 08:09 AM



Advertisments