Loading…

How we can get IP address of client in servlet?

Here are 2 methods for getting client’s IP address in Servlet:

HttpServletRequest.getRemoteAddr method returns IP of the client that sends request.

HttpServletRequestgetRemoteHost method returns the hostname of the client that is sending the request. However, it may return an empty string if hostname is unknown.

Suggest An Answer

No suggestions avaliable!

Latest post from Servlet Interview questions

Ask Question