From owner-freebsd-java@FreeBSD.ORG Fri May 2 09:03:25 2003 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4361637B401 for ; Fri, 2 May 2003 09:03:25 -0700 (PDT) Received: from dire.bris.ac.uk (dire.bris.ac.uk [137.222.10.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38CA343F93 for ; Fri, 2 May 2003 09:03:24 -0700 (PDT) (envelope-from Jan.Grant@bristol.ac.uk) Received: from mail.ilrt.bris.ac.uk by dire.bris.ac.uk with SMTP-PRIV with ESMTP; Fri, 2 May 2003 17:02:56 +0100 Received: from cmjg (helo=localhost) by mail.ilrt.bris.ac.uk with local-esmtp (Exim 3.16 #1) id 19Bcz1-0007Ui-00; Fri, 02 May 2003 17:01:59 +0100 Date: Fri, 2 May 2003 17:01:59 +0100 (BST) From: Jan Grant X-X-Sender: cmjg@mail.ilrt.bris.ac.uk To: Sheldon Hearn In-Reply-To: <20030409182725.GS9708@starjuice.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Jan Grant cc: freebsd-java@freebsd.org Subject: Re: Question about native 1.4.1, InetAddress.getLocalHost() - bug? X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2003 16:03:25 -0000 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 this: [[ 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.)