In a recent app I wrote I used the Reachability API but then when attempting to 
log on to my host I pinged 5 tries at the same time as attempting to log on. My 
thinking was that I could either wait the very long time for the logon attempt 
to time out or I could decide after 5 failed ping attempts that the host was 
down.

-----Original Message-----
From: cocoa-dev-bounces+jim.adams=sas....@lists.apple.com 
[mailto:cocoa-dev-bounces+jim.adams=sas....@lists.apple.com] On Behalf Of Greg 
Parker
Sent: Wednesday, June 01, 2011 9:12 PM
To: G S
Cc: cocoa-dev
Subject: Re: What is the point of a host-reachability test that doesn't test 
the reachability of the host?

On Jun 1, 2011, at 5:34 PM, G S wrote:
> Thanks for the response, Greg.
>
>> 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.)
>
> But since this test doesn't actually check the routes to these hosts,
> how would it be able to provide meaningful results even in these
> cases?

Reachability can check the first half of the first hop of the route. Consider 
the link-local case. You're connected to an ad-hoc network with no Internet 
router present. Reachability may be able to deduce that there is definitely no 
route to apple.com (17.149.160.49), but there may be a route to the link 
local-address second-floor-printer.local. (169.254.167.45). Reachability's 
host-specific test could return NO for "apple.com" and MAYBE for 
"second-floor-printer.local.".


> I figured the specific-host test pinged the host.

That would not be reliable anyway. Perhaps ICMP Echo packets are blocked by a 
router between you and the host. Then the "ping test" would say NO but a 
connection attempt would succeed. Perhaps ICMP Echo works but the service you 
actually want (like HTTP) is blocked by a firewall. Then the "ping test" would 
say YES but a connection attempt would fail.

Reachability does not answer all questions about Internet connectivity, but the 
answers it can give are reliable.


--
Greg Parker     gpar...@apple.com     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/jim.adams%40sas.com

This email sent to jim.ad...@sas.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to