Question about native 1.4.1, InetAddress.getLocalHost() - bug?
Jan.Grant at bristol.ac.uk
Fri May 2 09:03:25 PDT 2003
On Wed, 9 Apr 2003, Sheldon Hearn wrote:
> 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.
Tell me about it. I've just reexamined the documentation and it includes
If the operation is not allowed, an InetAddress representing the
loopback address is returned.
I'd not parsed this sentence correctly initially; I'd focussed on the
second clause not the first one. Seems braindead to me, but it's clearly
not a FBSD-specific issue. Cheers.
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287088 Fax +44 (0)117 9287112 http://ioctl.org/jan/
(Things I've found in my attic, #2: A hundredweight of pornography.)
More information about the freebsd-java