java.net.InetAddress
Andrew Haley
aph@redhat.com
Sat Jun 21 14:54:00 GMT 2003
Erik Poupaert writes:
>
> Both the java2/1.4.1 implementation on linux/Mozilla as the MsJava1
> implementation on win2k/IE return "127.0.0.1" to the question
> InetAddress.getLocalHost().getHostAddress(). So I don't think there
> is anything wrong with GCJ doing the same.
For a machine with more than one interface, and in practice that means
every machine on the Internet, the only thing to do is enumerate the
host's IP addresses. Even if you discover the IP address that a
machine uses to make outgoing connections, it might use a totally
different address for incoming ones.
> I personally try to avoid deploying software that relies on such
> brittle foundations (applets, mobile code, security manager, jre,
> ...). Instinctively, I feel it will invariably come back to haunt
> me...
>
> I just wish that people who don't need or otherwise elect to stay
> away from this circus, wouldn't be required to pay the price for
> it.
Out of interest, why do you want to know the local IP address in any
case?
Andrew.
More information about the Java
mailing list