Name: rlT66838 Date: 07/17/97
1. To get InetAddress object for local host, I wrote the source code like the following.
InetAddress thishost = InetAddress.getByName(null);
In this case, getByName returns the followings.
localhost/127.0.0.1
2. As the other way, I wrote the following code to get InetAddress object for local host.
InetAddress thishost = InetAddress.getLocalHost();
In this case, getLocalHost returns the followings on my environment.
icarus/XXX.XXX.XXX.XXX
(In fact, XXX.XXX.XXX.XXX is correct IP address.)
icarus is the host name for the machine executing that program.
So, I think getByName returns wrong result.
======================================================================
- duplicates
-
JDK-4073539 InetAddress get local host fails on Solaris in some cases
-
- Resolved
-