Re: Correct way to check for active/available internet connection?
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