SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, "www.google.com");
SCNetworkReachabilityFlags flags;
BOOL success = SCNetworkReachabilityGetFlags(reachability, &flags);
BOOL isDataSourceAvailable = success && (flags & kSCNetworkFlagsReachable) && !(flags &kSCNetworkFlagsConnectionRequired);
CFRelease(reachability);
if(isDataSourceAvailable)
{
// Do some network things.
}
SCNetworkReachabilityFlags flags;
BOOL success = SCNetworkReachabilityGetFlags(reachability, &flags);
BOOL isDataSourceAvailable = success && (flags & kSCNetworkFlagsReachable) && !(flags &kSCNetworkFlagsConnectionRequired);
CFRelease(reachability);
if(isDataSourceAvailable)
{
// Do some network things.
}