Google News
logo
Java Servlets - Interview Questions
How can a servlet get information about the client machine?
A servlet can use getRemoteAddr() and getRemoteHost() to retrieve the IP address and hostname of the client machine, respectively :
public String ServletRequest.getRemoteAddr()
public String ServletRequest.getRemoteHost()
Both values are returned as String objects. 
Advertisement