tonymillion Reachability
+(Reachability *)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress:&zeroAddress];
}
and AFNetworkReachabilityManager has
+ (instancetype)sharedManager {
static AFNetworkReachabilityManager *_sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
struct sockaddr_in address;
bzero(&address, sizeof(address));
address.sin_len = sizeof(address);
address.sin_family = AF_INET;
_sharedManager = [self managerForAddress:&address];
});
which means that both recommend that this is the right way to check your internet connection.
But I think that ONLY taking care that we connect to the Wi-Fi router is NOT CONSIDERABLE that the Wi-Fi router has Internet access, right?
Someone says in How to check network availability on iOS in a non-blocking way?
The first one checks to see if it can go to google.com, and the second one just checks if it’s possible to connect to the Internet (which, in his opinion, exists, although there is packet loss).
It's true?
source
share