Search code examples
iosreachability

Network link conditioner on 100% packet loss - why I am getting internet reachability status wrong?


I am checking the status of internet reachability using class "Reachability". But while testing, if I am setting 100% packet loss in developer settings, still I get reachability status as "ReachableViaWiFi". I am confused what's happening. Shouldn't it be "NotReachable" in that situation ?

Here is my code snippet:

Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];

if(networkStatus == NotReachable){
    NSLog(@"NotReachable");
}
else if(networkStatus == ReachableViaWiFi){
    NSLog(@"ReachableViaWiFi");
}
else if(networkStatus == ReachableViaWWAN){
    NSLog(@"ReachableViaWWAN");
}

Is there any other way that give me status as FALSE in this situation?


Solution

  • The number of packets that you lose doesn't influence reachability. After all, this could be just momentary (you took your phone into a shielded room, or a heavy electrical motor was just turned on). Reachability is about your WiFi, or 3G, or Ethernet on a Mac, being turned on. It's not about the quality of the connection.