Re: Reachability redux: what about the user experience?
Re: Reachability redux: what about the user experience?
- Subject: Re: Reachability redux: what about the user experience?
- From: Rich Siegel <email@hidden>
- Date: Mon, 27 Apr 2009 15:00:56 -0400
On 4/27/09 at 1:34 PM, email@hidden (Allan Nathanson) wrote:
kSCNetworkFlagsConnectionRequired != kSCNetworkFlagsConnectionAutomatic.
That is my understanding as well, thanks for confirming.
In this case, it is "possible" for your network traffic to reach the
target host but you must first establish a connection. This could via
the Network pref pane or menu extras and would likely involved dialing
a modem, starting a WWAN (3G/cell) network, establishing a link via
Bluetooth to a network, etc.
Right, and as I understand, kSCNetworkFlagsInterventionRequired
means that a connection was attempted, and that something
occurred that requires human intervention; so the host might be
reachable, but some direct action is necessary.
In general, your code should be looking for :
Boolean
tryToConnect(SCNetworkReachabilityFlags flags)
{
if (((flags & kSCNetworkFlagsReachable) != 0) {
((flags & kSCNetworkFlagsConnectionRequired) == 0)) {
// if reachable and no connection required
return TRUE;
}
// if not reachable OR a connection is required
return FALSE;
}
That's very close to what I came up with - my test is:
if (0 != (flags & kSCNetworkFlagsReachable))
{
// If a connection or intervention is required, then
don't try to connect.
if (0 == (flags & (kSCNetworkFlagsConnectionRequired | kSCNetworkFlagsInterventionRequired)))
return true;
}
Thanks for the help!
R.
--
Rich Siegel Bare Bones Software, Inc.
<email@hidden> <http://www.barebones.com/>
Someday I'll look back on all this and laugh... until they
sedate me.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden