• 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: Correct way to check for active/available internet connection?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct way to check for active/available internet connection?


  • Subject: Re: Correct way to check for active/available internet connection?
  • From: j o a r <email@hidden>
  • Date: Thu, 24 Jan 2008 22:41:10 -0800


On Jan 24, 2008, at 8:26 PM, John Joyce wrote:

Looks like there is not (or I've yet to find) a simple convenience method to ask the system if it thinks it's connected. Obviously, it would only really know if it is connected to a network, since the internet is not really a location in its own right.


Precisely - No API could provide a general "isConnected" property as the definition of what "isConnected" means differs from client to client. For that reason the API provides the second best solution:

	SCNetworkCheckReachabilityByName()  // ...or -ByAddress()

What is more interesting though is that this API can keep you notified of reachability changes via callbacks on the runloop. That might not be of interest for a simple one-shot command line app like yours (?), but for a server or a desktop app it is really nice.

j o a r


_______________________________________________

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: 
 >Re: Correct way to check for active/available internet connection? (From: John Joyce <email@hidden>)

  • Prev by Date: NSTextView scrolls to top of text container, not view, when inset
  • Next by Date: Re: String encoding problem (WSMethodInvocation)
  • Previous by thread: Re: Correct way to check for active/available internet connection?
  • Next by thread: NSWorkspace choosing to launch app from Time Machine backup
  • Index(es):
    • Date
    • Thread