[asio] iPad: resolver fails on a "fresh" 3G
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.
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).. <...> Maybe iOS active a PDP context for you when you first use the TCP protocol, so You will wait and re-try.
Oh, I see... Actually, I found out that it's not a matter of connection attempts - even if I do nothing but wait about a minute, and then try to resolve, it succeeds immediately. So the iPad probably sets-up PDP context automatically, but it takes some time. The only question now is why the browser is able to connect faster than my app.
On May 19, 2011, at 10:33 AM, Igor R wrote:
Oh, I see... Actually, I found out that it's not a matter of connection attempts - even if I do nothing but wait about a minute, and then try to resolve, it succeeds immediately. So the iPad probably sets-up PDP context automatically, but it takes some time. The only question now is why the browser is able to connect faster than my app.
Are you using the iOS reachability API? I think that gives you fast and accurate indication when you can reach a given site. Brad -- Brad Howes Calling Team - Skype Prague Skype: br.howes
Hi,
The only question now is why the browser is able to connect faster than my app.
I guess the browser uses some API to force the phone to establish a PDP context. I don't know why this happens automatically after some time, but this might be because of some background-service (update-checking, location-service, ...). -- Best regards, michi7x7
I guess the browser uses some API to force the phone to establish a PDP context. I don't know why this happens automatically after some time, but this might be because of some background-service (update-checking, location-service, ...).
Yes, this's probably what happens there. Now, prior to using ASIO, I call [NSURLConnection sendSynchronousRequest:...] with the address of one popular search engine :), and it automatically initializes the PDP. Of course, I have to find a more light-weight method having the same side-effect....
participants (4)
-
Brad Howes
-
Igor R
-
michi7x7
-
乔志强