Re: iOS; how to "connect" to 3G
Re: iOS; how to "connect" to 3G
- Subject: Re: iOS; how to "connect" to 3G
- From: Kyle Sluder <email@hidden>
- Date: Thu, 18 Oct 2012 13:52:40 -0700
On Thu, Oct 18, 2012, at 01:25 PM, M Pulis wrote:
> Thanks!
>
> Not using anything low level... hence the surprise.... we actually use
> it to determine if our login url is reachable; if not we work
> "offline". I'll take a deeper look at what we are doing there.
You can't use Reachability to determine if a URL is reachable. The
concept of a URL exists at a much higher level than Reachability
operates at.
Reachability determines if you have a route to a host at a hostname.
That means it asks the system to resolve the hostname if necessary, then
consults the routing table to determine if it has a rule to route
packets to that host out of the device.
It tells you nothing about whether the packets would actually make it
there once they've left your device, or if they did whether they could
be used to form form a working higher-level connection like HTTP.
If you want to determine whether you can connect to a server on a TCP
socket, the only thing you can do is attempt the connection.
If you want to determine whether you can access a resource over HTTP,
the only thing you can do is attempt to access the resource.
The only thing Reachability is good for is an early test to see if the
device knows it can't possibly communicate with a host because it can't
route packets to it. If this is the case, it also gives you a way to be
notified when circumstances change and you should try again.
--Kyle Sluder
_______________________________________________
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