View Full Version : InetAddress api doesn't work on my MAC

Jan 22, 2008, 12:50 AM
i wrote a code

InetAddress in = InetAddress.getByName("ubuntu");
} catch (UnknownHostException ex)

it doesn't work on my Mac,

but the same code returns IP of "ubuntu" machine on Windows.

Is there some problem that the api responds only when the machine is on Domain, my Mac is on network and can communicate to other pc( window or Mac)?

Jan 22, 2008, 01:00 AM
I'm not familiar with InetAddress -- so I can't speak to the correctness of the code. Looks like valid Java syntax.

The first thing I would try in troubleshooting is to see if your Mac can find the other machine. Go to terminal and type "ping ubuntu". If you don't get a response then there is something wrong between your Mac and its DNS server.

Jan 22, 2008, 02:56 AM
thanks numero,
i tried "ping ubuntu" on terminal, it says unknown host.
BUT.., we hv a terminal command "net lookup [HostName]"
when i type "net lookup ubuntu" it gives its IP Address.
How?? although my m/c is not on domain.
Now there is a problem in net lookup command (otherwise i'd hv taken this command as a solution for name resolution).
when i type "net lookup 5674" it gives an IP (by some simple maths of taking modulus).
Is there any other solution??
and if i hv to take my Mac to a domain (the DNS server is configured on windows), please tell me any URL that best describes how to get MAC on Domain, and log on with a domain user name & password