getaddrinfo in iPhone

前端 未结 1 1632
清歌不尽
清歌不尽 2021-02-06 13:35

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

相关标签:
1条回答
  • 2021-02-06 14:03

    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.

    0 讨论(0)
提交回复
热议问题