Switch "airplane mode" off and on does not establish a "3G connection". You may active a PDP context before call tcp::resolver::query(connect internet)..
Moreover, it seems that if I try the above query several times, it succeedes after a while. Maybe iOS active a PDP context for you when you first use the TCP protocol, so You will wait and re-try.
You can compare the IP of iPad after switch "airplane mode" off and on and after open the browser.
Message: 3 Date: Wed, 18 May 2011 16:03:41 +0300 From: Igor R
To: boost-users@lists.boost.org Subject: [Boost-users] [asio] iPad: resolver fails on a "fresh" 3G connection Message-ID: Content-Type: text/plain; charset=UTF-8 Hello,
I admit this is probably not a pure ASIO question, but perhaps someone already encountered the following issue (boost 1.46, iOS4.3).
When trying to resolve a host name just after 3G connection is established (eg., switch "airplane mode" off and on), I get the following error: "Host not found (authoritative)". The query looks like this: tcp::resolver::query query(tcp::v4(), "my.host.com", "9988");
On the other hand, if prior to the above query I open the browser or some other application that connect to the Internet, then the query works correctly. Moreover, it seems that if I try the above query several times, it succeedes after a while.
Another interesting point: all the above occurs with 3G connection only, while with WiFi everything works well.
What's could be the reason of such a weird behavior?
Thanks.