Re: iOS; how to connect to 3G
On Oct 18, 2012, at 12:55 PM, M Pulis tooth...@fastq.com wrote: My iOS app uses the Reachability sample code to detect network availability to work offline or online. When using 3G, we get to the connectionrequired state. What to do then? We try a login to our web site and that fails. WIFI works great, but we need 3G also. What am I missing or should read up on? If you use CF or NS (or anything build on top of that) to connect, then it should just work. If you are using raw BSD sockets, then there is no way to connect other than using CF or NS. Also Reachability isn't meant to be used to determine online vs offline. Its meant to determine if it is a good time to try to connect or not. Due to realities of networking it is entirely possible for Reachability to tell you try to connect and to fail completely. Basically when using Reachability, you should always use the callback to know when to retry any previously failed connections, and once you get a callback that says that connection is possible, then you should try to make the connection, while continuing plan for possible failure. -- David Duncan ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iOS; how to connect to 3G
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. Gary On Oct 18, 2012, at 1:12 PM, David Duncan wrote: On Oct 18, 2012, at 12:55 PM, M Pulis tooth...@fastq.com wrote: My iOS app uses the Reachability sample code to detect network availability to work offline or online. When using 3G, we get to the connectionrequired state. What to do then? We try a login to our web site and that fails. WIFI works great, but we need 3G also. What am I missing or should read up on? If you use CF or NS (or anything build on top of that) to connect, then it should just work. If you are using raw BSD sockets, then there is no way to connect other than using CF or NS. Also Reachability isn't meant to be used to determine online vs offline. Its meant to determine if it is a good time to try to connect or not. Due to realities of networking it is entirely possible for Reachability to tell you try to connect and to fail completely. Basically when using Reachability, you should always use the callback to know when to retry any previously failed connections, and once you get a callback that says that connection is possible, then you should try to make the connection, while continuing plan for possible failure. -- David Duncan ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iOS; how to connect to 3G
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 (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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com