title: Get hostname from request
body: <p>I'm running my application on Windows Server 2008 on an Intranet.</p>
  
  <p>To login the application tries to get the hostname from the request to validate the user.
  However, sometimes the application returns the IP address instead of the name and some time later, without doing anything the application is able to resolve the name and everything works fine...</p>
  
  <p>This is the code I'm using to get the hostname:</p>
  
  <pre><code>InetAddress inaHost = InetAddress.getByName(request.getRemoteAddr());
  String hostname = inaHost.getHostName();
  System.out.println("[[ Hostname = " + hostname + " ]]");
  </code></pre>
  
  <p>Is this because of the Intranet configuration (DNS!?), or is something wrong with my code, or witchcraft or something?</p>