InetAddress.getLocalHost() is supposed to return the ip address of the local
host.  But on my machine (Debian Linux, Blackdown 1.3, using DHCP) it
returns 127.0.0.1.  This makes sense, sort of, because 127.0.0.1 is a valid
address for this machine.  but it is useless.

Here is the interesting thing.  my /etc/hosts looks like this:

127.0.0.1       aganthapus      localhost

but if I change it to this:

127.0.0.1       localhost

then it works correctly!  "aganthapus" is the machine name, and I guess
debian put it in there.  I think this makes sense because getLocalHost()
does this:

localHost = getAllByName(localHost.hostName)[0];

so it finds the first entry that matches "aganthapus", which is 127.0.0.1.
So my question is: is it wrong for the localhost entry in /etc/hosts to
contain the machine name?  If not, getLocalHost() is broken.

Paul


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to