InetAddress api doesn't work on my MAC

Discussion in 'Mac Programming' started by vikasu, Jan 21, 2008.

  1. vikasu macrumors newbie

    Nov 6, 2007
    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)?
  2. numero macrumors regular

    Jul 23, 2002
    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.
  3. vikasu thread starter macrumors newbie

    Nov 6, 2007
    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

Share This Page