On Thu, 10 Sep 1998 14:44:50 -0700, Masuda, Bond wrote:
>Hello Michael,
>
>Thank you for replying so quickly..
>
>The particular address in my message was a bogus address.. I was
>assuming that would be clear when I mentioned the whatever.home.edu. In
>anycase, yes, my DNS is setup properly, as 'nslookup' and 'host' both
>return a hostname and address... in particular,
>
>for IP = 206.19.60.13 I get
>hostname = chinook.tenthmtn.com
>
>but the Java program in my previous message does not work. I believe it
>is capable of doing the reverse lookup... as is my understanding...
>instantiation of the InetAddress object fails if reverse lookup is to
>fail. However, my program continues to execute to the point where it
>calls the getHostName() method. So, to me that means that the object was
>successfully instantiated... which leads me to conclude that reverse
>lookup was successful. However, the getHostName method returns the ip
>address in string representation instead of the hostname. It seems to me
>that the InetAddress object is instantiated, the ipString accepted, the
>reverse lookup successful, but the hostname is not stored in
>InetAddress.
Here is what I ran on my machine: (Linux 2.0.35 with JDK 1.1.6)
class test
{
public static void main(String[] args) throws Throwable
{
System.out.println(java.net.InetAddress.getByName(args[0]));
}
}
Running it with:
java test 204.146.18.33
produces:
www.ibm.com/204.146.18.33
>In case this matters, I am on Redhat 5.1 Linux kernel 2.0.35. I've used
>both JDK 1.0.2 and JDK 1.1.5.
>
>You mention that you are able to do reverse lookup on your machine. What
>platform are you on? And did you use the code in my previous message or
>some other Java program? My java program DOES work on windows 95 and
>Windows NT platforms... it DOESN'T WORK ONLY ON Linux.
I have also run your program (with the addition of an import statement
that was not in your original posting) and it produced the correct answer:
java revDNS 204.146.18.33
Hostname is :www.ibm.com
Again, this is on Linux 2.0.35 kernel (x86 CPU) on my small network here.
I have also run both your program and my little test program and they
both produce the same results under Windows using the Sun 1.1.6 JDK.
(And I assume it is the same JDK you are using)
The same result also happens on my Linux 2.0.35 (Alpha 21164) system, but
that was running a JDK 1.1.5 variant.
Michael Sinz -- Director of Research & Development, NextBus Inc.
mailto:[EMAIL PROTECTED] --------- http://www.nextbus.com
My place on the web ---> http://www.users.fast.net/~michael_sinz