After running the following code i noticed that the ip address resolves to the same ip address and not the host name that should be associated with it.
It's not until i run the following code and get a positive resolution do i get an actual host name from an ip address from the cache. But the first block of code should be a positive resolution also. Do you guys think that's its because getByName() is supposed to take a host of a specific form and that's it?Code:InetAddress ina = InetAddress.getByName("209.249.116.195"); System.out.println(ina.getHostName()); // prints 209.249.116.195
Code:InetAddress ina = InetAddress.getByName("www.sun.com"); System.out.println(ina.getHostAddress()); //209.249.116.195 InetAddress ina2 = InetAddress.getByName("209.249.116.195"); System.out.println(ina2.getHostName()); //www.sun.com




Reply With Quote