tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <>
Subject Re: Obtaining client connection
Date Sat, 13 Sep 2003 03:15:37 GMT
It sounds like all you want is
request.getRemoteAddr()/request.getRemoteHost().  These give you the
IP/DNS-name of the client's box.  All of this is taken from the Socket
(since there really isn't any other way to get at it).

If you need to get the IP on your machine that they connected to, then you
can't.  request.getServerName() reports what was sent in the Headers.

"Peter Guyatt" <> wrote in message
> Hi There,
> I am not too sure if you are actually able to do this but I have a need to
> get the IP address/hostname of the client that has accessed a page in our
> web application.
> This is mainly for security/auditing purposes, however I really need to
> the client Socket connection and not the ip address given in the
> of the HTTP header.
> Is there any way of obtaining a handle on the client socket that has
> connected to the server.
> Any help on this matter would be greatly appreciated.
> Currently we are using Tomcat version 4.1.18
> Many Thanks
> Pete Guyatt

View raw message