network configuration change notification
network configuration change notification
- Subject: network configuration change notification
- From: Michael Brian Bentley <email@hidden>
- Date: Wed, 25 Nov 2015 10:47:28 -0800
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden