Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Apr 2003 20:27:25 +0200
From:      Sheldon Hearn <sheldonh@starjuice.net>
To:        Jan Grant <Jan.Grant@bristol.ac.uk>
Cc:        freebsd-java@freebsd.org
Subject:   Re: Question about native 1.4.1, InetAddress.getLocalHost() - bug?
Message-ID:  <20030409182725.GS9708@starjuice.net>
In-Reply-To: <Pine.GSO.4.44.0304091833200.7708-100000@mail.ilrt.bris.ac.uk>
References:  <Pine.GSO.4.44.0304091833200.7708-100000@mail.ilrt.bris.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On (2003/04/09 18:36), Jan Grant wrote:

> Should this do what I think it should? When I created a ServerSocket
> using
> 
> 	s = new ServerSocket(1234, 0, InetAddress.getLocalHost());
> 
> I wound up with netstat reporting that I had a TCP connection listening
> on 192.168.0.1.1234. From the description of the call, I'd expect
> to see it listening on 127.0.0.1.1234.

I must admit, I'd expect any IP address bound to a local interface to be
valid.  In other words, I'd expect to see what you're seeing.

Note that jre-1.4.1 on Windows gives the same results.

Note that the API documentation says that getLocalHost() returns IP
address of "the local host", not "localhost".  This is vague in the
context of hosts with multiple local addresses.

Ciao,
Sheldon.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030409182725.GS9708>