I am working on an application which needs VPN connection for Data Synchronization. I am using reachability class to check the Host availability.
@Functionality :- When app is connected to VPN through Junos Pulse app, data synchronization should proceed if VPN connection is lost it should throw the Alert message. Now it is working for the scenario given below.
@Working scenario :- VPN is connected initially, i completed the sync and then disconnected the VPN manually from Junos Pulse. Now i am trying to sync again it is throwing alert which is expected.
@Problem Scenarion :- I completed the sync initially and left the app idle to get VPN disconnected automatically. Now after VPN gone i am trying to sync again. It does not through the alert that VPN not there. It attempts the sync functionality and fails as server is not accessible without VPN.
I am exhausted by searching it's solution on internet. I am pasting my Code snippet here. Any suggestion is highly appreciated.
-(BOOL)checkHostAvailability
{
Reachability *objReach = [Reachability reachabilityWithHostName:[self hostServer]];
NetworkStatus hostAvailability = [objReach currentReachabilityStatus];
if(hostAvailability == ReachableViaWiFi || hostAvailability == ReachableViaWWAN) {
RLog(@"Host is Reachable");
return YES;
}
return NO;
}
objReach
tonil
each time before checking for the host reachability. See if that works for you. I am no longer in the same organisation to cross verify the solution :( – Sabbatical