Re: What is the point of a host-reachability test that doesn't test the reachability of the host?
Re: What is the point of a host-reachability test that doesn't test the reachability of the host?
- Subject: Re: What is the point of a host-reachability test that doesn't test the reachability of the host?
- From: Greg Parker <email@hidden>
- Date: Wed, 1 Jun 2011 17:30:58 -0700
On Jun 1, 2011, at 5:13 PM, G S wrote:
> I'm trying to implement some robust network-failure handling in my
> iPhone app. The test of whether my host is reachable returns YES even
> when connected to a router that has no Internet connection. Apple's
> docs say, "A remote host is considered reachable when a data packet,
> sent by an application into the network stack, can leave the local
> device." And indeed this is how it behaves. You can pull the cable
> out of your router, and as long as your phone is connected to it, the
> host test will claim any host is reachable.
Yep. Reachability checks the first hop only. It does not look at the rest of the Internet.
> So why take an address at all? I'm using Donoho's enhancement of
> Apple's Reachability example, and I don't see the difference between
> the general "Internet" test (reachabilityForInternetConnection) and a
> specific-host test (reachabilityWithHostName).
There are circumstances where a subset of the Internet's hosts may be reachable. For example, you may be able to reach link-local names without a broader Internet connection. Or you may be able to reach a host behind a VPN only when the VPN is active. (I don't know what Reachability actually does in these cases, but it's the sort of thing that the API was designed to handle.)
> And how are people
> truly testing the availability of a host, given the bogus nature of
> these results?
The only way to know whether you can communicate with a host is to attempt to communicate with it.
Reachability cannot say "YES, you can communicate with this host". It can only say "NO" or "MAYBE". Reachability notifications add "NO became MAYBE, try again now" and "MAYBE became NO, stop trying".
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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