Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to check the Network availability for 3G and 4G connection

    • 0
    • 2
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 712
    Comment on it

    Following code will help in you to check the network availability for 3G and 4G connection

    const char *host_name = "google.com";
        BOOL _isDataSourceAvailable = NO;
        Boolean success;
    
        //Creates a reachability reference to the specified
        //network host or node name.
        SCNetworkReachabilityRef reachability =
        SCNetworkReachabilityCreateWithName(NULL,host_name);
    
        //Determines if the specified network target is reachable
        //using the current network configuration.
        SCNetworkReachabilityFlags flags;
    
        success = SCNetworkReachabilityGetFlags(reachability, &flags);
        _isDataSourceAvailable = success &&
        (flags & kSCNetworkFlagsReachable) &&
        !(flags & kSCNetworkFlagsConnectionRequired);
    
        CFRelease(reachability);
        return _isDataSourceAvailable; 
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: