2

I am using reachability class in my application to monitor networkstate. Apple has mentioned in their docs to provide support for IPv6 types.

I found that some iPV4 types are using in reachability class. I have searched for new reachability class and did not find.. is there any new class for check iPv6 network reachability state.?

   + (Reachability*) reachabilityForLocalWiFi;
    {
        struct sockaddr_in localWifiAddress;
        bzero(&localWifiAddress, sizeof(localWifiAddress));
        localWifiAddress.sin_len = sizeof(localWifiAddress);
        localWifiAddress.sin_family = AF_INET;
        // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
        localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
        Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress];
        if(retVal!= NULL)
        {
            retVal->localWiFiRef = YES;
        }
        return retVal;
    }
Sabareesh
  • 3,585
  • 2
  • 24
  • 42
  • I've posted a reply to what I think is a duplicate question here: http://stackoverflow.com/questions/31938536/reachability-and-ipv6/37057558#37057558 – Andrew Y May 13 '16 at 16:06

1 Answers1

1

Found this on Apple's forums. It describe the best the current status of this issue:

Q: "We are using reachabilityForLocalWiFi from reachability class? I notice reachabilityForLocalWiFi method is using reachabilityWithAddress (local ip address)? I am wondering how will it work for the ivp6 address? Currently it works for ipv4 address."

A: (By "the Eskimo"): "I don’t think that will be a problem. Even if the device only has IPv6 connectivity to the outside world, it should still be able to get to link-local IPv4 addresses (169.254/16), which is what +reachabilityForLocalWiFi uses."

John Slegers
  • 45,213
  • 22
  • 199
  • 169
Amir Aharon
  • 291
  • 2
  • 9