title: how to get the local machine ip from java applet
body: <p>hi i am using the following code to get the local machine ip from java applet
  but i always getting 127.0.0.1 instead of actual ip</p>
  
  <pre><code>public String ip;
  public void init()
  {
      try
      {
          Enumeration&lt;NetworkInterface&gt; n = NetworkInterface.getNetworkInterfaces();
          for (; n.hasMoreElements();)
          {
              NetworkInterface e = n.nextElement();
  
              Enumeration&lt;InetAddress&gt; a = e.getInetAddresses();
              for (; a.hasMoreElements();)
              {
                  InetAddress addr = a.nextElement();
                  ip = "Really " + addr.getHostAddress();
                  System.out.println(ip);
              }
          } 
      }
      catch(Exception ex)
      {
      }       
  }
  </code></pre>