Hi,
I have a machine setup with two different DNS names. (deathstar =3D zpac23 =
=3D
172.25.181.23 <http://172.25.181.23/> and zpac23 is the canonical hostname)=
.
When I do this:
InetAddress xaddr =3D Address.getByName("deathstar");
InetAddress saddr =3D InetAddress.getByName("deathstar");
System.out.printlin(xaddr.getHostName());
System.out.printlin(saddr.getHostName());
-------------- This is the output I get: ----------------
zpac23
deathstar
--------------
The documentation for
InetAddress.getHostName()<http://java.sun.com/j2se/1.4.2/docs/api/java/net/=
InetAddress.html#getHostName%28%29>,
says this:
"Gets the host name for this IP address.
If this InetAddress was created with a host name, this host name will be
remembered and returned; otherwise, a reverse name lookup will be performed
and the result will be returned based on the system configured name lookup
service........"
So, as per this, Address.getByName() isn't returning a proper InetAddress
object. Right? Is there a solution someone can suggest? I've tried this wit=
h
1.6.4 and 2.0.0 and got the same result. I am using dnsjava in the most
simplistic manner - one call to Lookup.setDefaultResolver() for setup and
regular calls to Address.getByName().
I am using dnsjava with jCIFS and this behavior is causing problems with
jCIFS (triggering an apparent problem with SMB servers, to be precise).
Thanks in advance
-Praveen
|