[Advanced-java] InetAddress.getLocalHost ( )

Guneet Singh Sahai guneet at in.fiorano.com
Thu Jul 10 08:00:40 2003


Hi All,

I encountered a rather strange problem with InetAddress.getLocalHost ( );

Here's my code snippet

   String name = InetAddress.getLocalHost ().getHostName ();
   System.out.println ("Host Name = " + name);
   
   String address = InetAddress.getLocalHost ().getHostAddress ();
   System.out.println ("address = " + address);

Upon executing this snippet on one machine, I get the following output

Host Name = guneet
address = 164.164.128.225
 
while on another machine I got

Host Name = 0.0.0.0
address = 0.0.0.0

The other machine is connected to the network and has a valid IP. Pinging
this machine also works fine. Both the machines are win 2k and I'm using
sun's jdk 1.4.0

Any ideas what could be going wrong ?

Thanks
Guneet 


Fiorano MailServer
All incoming and outgoing mails are scanned for Virus and Spam
http://www.fiorano.com