InetAddress - is it broken??

Craig A. Vanderborgh craigv@voxware.com
Thu Jun 12 19:52:00 GMT 2003


Hello gcjland:

I have discovered the following apparently malignant behavior in
InetAddress.getLocalHost() on linux.  Given the following brainless
test program:

import java.net.*;

public class InetAddressTest {
  public static void main(String[] args) {
    System.out.println("getting local host address..");
    try {
      InetAddress address = InetAddress.getLocalHost();
      System.out.println(address);
    } catch (UnknownHostException e) {
      System.out.println("Could not find local address");
    }

  }
}

What I see is this:
getting local host address..
zetar/127.0.0.1

The environment is x86linux (RedHat 8.0), gcc/gcj version as follows:
gcj (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

All documentation I have, as well as relevant experience, suggests that
this is incorrect.  Perhaps my expectations are incorrect, however.

Please advise.

TIA,
craig vanderborgh
voxware incorporated







More information about the Java mailing list