This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: InetAddress.getLocalHost()
> But in that case you really do need to know which of your
> interfaces is visible to the outside world, and simply picking an
> arbitrary one doesn't help much.
The machines I'm currently testing on, have just one interface. So arbitrarily
picking this one, is a nasty hack, but it works for now.
How to make such setup work on machines with multiple interfaces (e.g. one
ethernet card and one wireless card), is indeed a growing issue. The API
NetworkInterface.getNetworkInterfaces() and the objects returned don't reveal
sufficient information to make an informed decision.
By the way, I guess machines with multiple network interfaces will currently confuse
quite a bit of software, while we can expect this setup to become more and prevalent
in the future.