I prepare small application. When I restart my iPhone 3G (with 3G internet connection) and install this application getaddrinfo always return EAI_NONAME(8). I close application
What's probably happening here is that getaddrinfo()
is not blocking to wait for the DNS lookup, which is possibly a good thing since DNS lookups on iPhone can take a very long time. Once you've done the lookup elsewhere, it's giving you the cached answer.
Take a look at CFHost, which is the preferred way to get this kind of information on iPhone. It supports asynchronous callbacks to let you know when the information is available, or you can make synchronous calls if you like.