Re: An API for Airplane mode on iOS?
Re: An API for Airplane mode on iOS?
- Subject: Re: An API for Airplane mode on iOS?
- From: email@hidden
- Date: Tue, 09 Feb 2016 17:23:04 +0900
> On Feb 9, 2016, at 4:02 PM, Jens Alfke <email@hidden> wrote:
>
>
>> On Feb 8, 2016, at 9:45 PM, Glenn L. Austin <email@hidden> wrote:
>>
>> According to the docs on Reachability (possibly lost in the mists of time...), Reachability isn't really designed to tell you whether your net access *will* succeed, but to give you reasons that your last access *failed.*
>
> It’s not that surprising. There’s no guarantee that any IP packet will make it across the network, and no way to tell whether a host really is reachable without actually sending a packet to it (and back.) So the only way Reachability could tell you an access *will* succeed would be if it were constantly pinging the server, which is obviously impractical.
>
> All Reachability tells you is whether there is an active network interface that can be used to route a packet one hop toward the desired host.
>
> ―Jens
> ______________________________
Indeed.
I like to call this "The Truth About Sockets", or "It Would Be Nice If Apple and Other API Vendors Just Shared Precisely What They Do To Determine Which User Friendly Network-Related Error Message To Present To Users In Their Apps"
Safari as an example does try the connection first. Apple recommends this.
After a failure or three it is good to attempt a reasonable explanation to the user.
Pretty easy to determine if you're getting loop back or no initial hop.
A little fancier to look at getting more hops but destination server not responding.
Really more work to understand when you're connected to a captive network but not authenticated and try to let users know or to deal with cellular data turned off for an app and not know.
In the end the first step is always the same.
Try to connect first.
Even the venerable Beej's Guide to Sockets says this.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden