Question - How can a servlet get information about the client machine?
Answer -
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.