Domain name won't resolve to an IP address.

by Mike Turek » Tue, 28 Sep 2010 06:23:31 GMT


Sponsored Links
 Hello Android Developers,

I am working on a program that will connect to a time server (time-
a.nist.gov), retrieve the timestamp, and place it in a text field.

However, when I create the socket, I get an UnknownHost Exception for
time-a.nist.gov


Some ideas I've gotten to fix it:

1. put the <uses-permission
android:name="android.permission.INTERNET" /> tag right before the </
manifest> tag. I did this, and the change is still there.

2. use the static InetAddress.getByName() function to convert to an IP
address (this still throws the same exception)

When I pass the IP address (129.6.15.28) to the socket constructor,
the program works fine. It only breaks when I use the actual domain
name.

Another note. I have written this program in Java and it works
perfectly fine.

If anyone has any ideas, I'd love to hear them! Thank you!

--



Domain name won't resolve to an IP address.

by { Devdroid } » Tue, 28 Sep 2010 19:27:22 GMT


 > If anyone has any ideas, I'd love to hear them! Thank you!

You could be using DNS which simply malfunction (or your device
got no DNS specified at all - worth checking). Try using other DNS,
or, if you got any domain of your own, delegate something like,

either:

time.mydomain. IN CNAME time-a.nist.gov.

or

time.mydomain IN A 129.6.15.28

and us that domain. However, if the culprit is DNS, it sill may
not solve your problem. Checking how queriers are resolved
(i.e. by using dig tool) could move you forward.

--


Sponsored Links