Hi,

With the switch to NEHotspotHelper, I wonder if the following still works to indicate a network configuration change occurred? It indicates it is worth looking, instead of polling every few seconds.

CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center
                                    NULL, // observer
                                    onNetworkChangeCallback, // callback
CFSTR("com.apple.system.config.network_change"), // event name
                                    NULL, // object
CFNotificationSuspensionBehaviorDeliverImmediately);

static void onNetworkChangeCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{
    NSString* notifyName = (__bridge NSString*)name;

// this check should really only be necessary if you reuse this one callback method
    //  for multiple Darwin notification events

if ([notifyName isEqualToString:@"com.apple.system.config.network_change"]) {

        @autoreleasepool
        {
[[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: nil];
        }
    }
}

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to