top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do you find out what client machine is making a request to your servlet ?

+3 votes
462 views
How do you find out what client machine is making a request to your servlet ?
posted Feb 13, 2015 by Dominic

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The ServletRequest class has functions for finding out the IP address or host name of the client machine. getRemoteAddr() gets the IP address of the client machine and getRemoteHost() gets the host name of the client machine.

Getting a client’s address and hostname requires that you:

Get clients ip adfress using HttpServletRequest.getRemoteAddr().
Get clients hostname using HttpServletRequest.getRemoteHost().
answer Feb 16, 2015 by Karthick.c
...