i create vpn connection using systemconfiguration framework
i handle connection states with following code
+(SCNetworkConnectionRef)observeService:(NSString *)ident
{
SCNetworkConnectionRef con = nil;
SCNetworkConnectionContext scncctx = {0, NULL, NULL, NULL, NULL};
con = SCNetworkConnectionCreateWithServiceID (NULL, (__bridge CFStringRef)ident, connectionCallBack, &scncctx );
CFDictionaryRef statDict = SCNetworkConnectionCopyStatistics(con);
if (statDict != NULL) {
[[Log instance]logInfo:@"%@", statDict];
}
SCNetworkConnectionScheduleWithRunLoop(con, CFRunLoopGetMain() ,kCFRunLoopDefaultMode);
return con;
}
void connectionCallBack(SCNetworkConnectionRef
connection,SCNetworkConnectionStatus stat,void *info)
{
SCNetworkConnectionStatus status = SCNetworkConnectionGetStatus(connection);
switch(status) {
case kSCNetworkConnectionInvalid:
{
}
break;
case kSCNetworkConnectionDisconnected:
{
}
break;
case kSCNetworkConnectionConnecting:
{
}
break;
case kSCNetworkConnectionConnected:
{
}
break;
case kSCNetworkConnectionDisconnecting:
{
}
break;
}
but i cant recognize connection errors
all of lost connections are fall in Disconnected case
Is it possible to determine manual disconect and lost connection ?