title: Cannot get hostname from getHostName
body: <p>I am trying to get hostname/computer name using this method. Unfortunately i only can get localhost but not other computer.</p>
  
  <pre><code>private String getHostName(String _strIP) {
      try {
          InetAddress inetAddress = InetAddress.getByName(_strIP);
          System.out.println("getHostAddress : " + inetAddress.getHostAddress());
          System.out.println("getHostName : " + inetAddress.getHostName());
          System.out.println("getCanonicalHostName : " + inetAddress.getCanonicalHostName());
          return inetAddress.getHostName();            
      } catch (UnknownHostException e) {
          e.printStackTrace();
      }
      return strDefaultHostName;
  }
  </code></pre>
  
  <h3>the result (not localhost)</h3>
  
  <pre><code>getHostAddress : 192.168.2.139
  getHostName : 192.168.2.139
  getCanonicalHostName : 192.168.2.139
  </code></pre>
  
  <h3>the result (localhost)</h3>
  
  <pre><code>getHostAddress : 127.0.0.1
  getHostName : localhost
  getCanonicalHostName : localhost
  </code></pre>
  
  <p>Thank you</p>