This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: InetAddress - is it broken??
- From: Michael Koch <konqueror at gmx dot de>
- To: "Craig A. Vanderborgh" <craigv at voxware dot com>, java at gcc dot gnu dot org
- Date: Tue, 17 Jun 2003 12:58:38 +0200
- Subject: Re: InetAddress - is it broken??
- References: <1055447814.24841.585.camel@zetar>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Donnerstag, 12. Juni 2003 21:56 schrieb Craig A. Vanderborgh:
> 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.
I just tried it here. With GCJ it returns:
getting local host address..
asterix.konqueror.de/192.168.1.3
With SUNs JDK 1.4.1_01 it returns:
getting local host address..
asterix/192.168.1.3
I dont know why your IP is 127.0.0.1. Perhaps your /etc/hosts is
configured braindead.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+7vReWSOgCCdjSDsRApKZAJ0dX+6ezqpxO7a5WHqpFZQRNa+owQCfdbqi
MS7qmhNMYFMQw28Y1jFKQyk=
=8t4l
-----END PGP SIGNATURE-----