Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vikasu

macrumors newbie
Original poster
Nov 6, 2007
12
0
i wrote a code

try
{
InetAddress in = InetAddress.getByName("ubuntu");
System.out.println(in.getHostAddress());
} catch (UnknownHostException ex)
{
ex.printStackTrace();
}

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)?
 

numero

macrumors regular
Jul 23, 2002
106
3
OR
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.
 

vikasu

macrumors newbie
Original poster
Nov 6, 2007
12
0
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.