• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can I connect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Can I connect? (From: Jeremy Matthews <email@hidden>)

  • Prev by Date: Re: Register/Function Parm Mapping for 64-bit Was: isTemporaryID unrecognized selector…
  • Next by Date: Re: Register/Function Parm Mapping for 64-bit Was: isTemporaryID unrecognized selector…
  • Previous by thread: Can I connect?
  • Next by thread: [Moderator] List Guidelines - Update (noted at top)
  • Index(es):
    • Date
    • Thread