How to print the user machine name (Host Name) in java.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ukbasak
    New Member
    • Oct 2008
    • 1

    How to print the user machine name (Host Name) in java.

    Hi,

    I tried to print user name who ever accesss application. I added the code
    request.getHost Name() and request.getRemo teAddr().

    The get.getRemoteAd dr() is showing IP address but the code request.getHost Name() should show the host name but it also show the ip address also.

    please give me any solution so that client machine name can be found.

    Thanks in advance....

    Rgd,
    Uttam
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    I assume that request in your code above above is an HttpServletRequ est object then from the API specs

    Originally posted by API specs
    If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address.
    i.e It's not always possible to get the hostname.

    Comment

    Working...