Re: Can I connect?
Re: Can I connect?
- Subject: Re: Can I connect?
- From: Kyle Sluder <email@hidden>
- Date: Sat, 4 Sep 2010 20:01:05 -0700
On Sep 4, 2010, at 7:11 PM, Jeremy Matthews <email@hidden> wrote:
> In my application (desktop) I am checking for a network connection, and I've seen people use a few different techniques...
>
> 1) NSURL
> 2) SCNetworkReachabaility
> 3) NSSocketPort
>
> Anyone have experience or best practices on using one vs another?
>
The ONLY way to determine if you can connect to a host is to actually try the connection. "Reachability" is a fast way to check if there's a potential route to the host from any of the interfaces on the machine. If the machine is connected to a properly configured router, this answer will always be yes even if the host is down or the router isn't connected to the Internet.
NSURL and NSSocketPort are just network connection APIs operating at different layers of abstraction.
--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