Reachability and IPv6

后端 未结 2 1210
梦谈多话
梦谈多话 2020-12-31 03:14

One of my project uses the Apple\'s Reachability class in order to be monitor the network state and be notified in case of changes.

After reading this article about

2条回答
  •  鱼传尺愫
    2020-12-31 03:45

    I also have similar doubt regarding IPv6 and Reachability class. Apple has asked in their docs to provide support for IPv6 types also like (struct in_addr6, AF_INET6, struct sockaddr_in6 etc) but the class seem to be not updated yet to have these types. This is the doubt that I am having. I am yet to try IPv6 tests but just observed while doing the static code checks. Some changes might be required.

    Reachability.m

    + (instancetype)reachabilityForInternetConnection
    {
        struct sockaddr_in zeroAddress;
    
        bzero(&zeroAddress, sizeof(zeroAddress));
    
        zeroAddress.sin_len = sizeof(zeroAddress);
    
        zeroAddress.sin_family = AF_INET;
    
        return [self reachabilityWithAddress:&zeroAddress];
    }
    

提交回复
热议问题