Re: Problems detecting an active internet connecting using SystemConfiguration
Re: Problems detecting an active internet connecting using SystemConfiguration
- Subject: Re: Problems detecting an active internet connecting using SystemConfiguration
- From: Ryan McGann <email@hidden>
- Date: Sat, 15 Mar 2003 13:31:52 -0800
On Saturday, March 15, 2003, at 11:51 AM,
email@hidden wrote:
Here's the method I use in my Dejal Simon product, that seems to cover
all cases. I check two sites just in case the first one is unavailable
for some reason:
...snip...
We originally were doing the same thing as your code snippet, but ran
into additional instances where this was an unreliable test to verify
whether there was a viable "active" interface. For example, if the user
is connected to an internal network with no DNS servers,
SCNetworkCheckReachabilityByName won't work because it requires DNS
servers to be active. Also, in some instances the DNS servers weren't
"up" if we called SCNetworkCheckReachabilityByName from inside our
System Configuration notification callbacks; putting a sleep in there
worked but seemed ugly. In all we concluded that the SCNetwork APIs
should not be used to see if there's if there's an active internet
connection.
Instead of using the SCNetwork APIs we copy all the kSCEntNetLink
entities from the Dynamic Store using SCDynamicStoreCopyMultiple, use
CFDictionaryApplyFunction to iterate over the returned values and test
to see if the kSCIPv4Addresses entity is non-NULL & non-empty. This
seems to work in all cases we've tested, including Ethernet, AirPort
and PPP. If anybody wants the code I'd be happy to send it to them.
Ryan McGann
Macintosh Internet Security
Symantec Corporation
Office: (310) 449-8556
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.