Sabareesh
Sabareesh

Reputation: 3605

iPv6 support for reachability Class

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;
    }

Upvotes: 2

Views: 1245

Answers (1)

Amir Aharon
Amir Aharon

Reputation: 291

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."

Upvotes: 1

Related Questions