Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • To check that internet is available or not.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 268
    Comment on it

    Hi Friends,
    sometimes we face problem in internet connectivity, With the following lines of code we can check whether we are connected to internet or not.

    - (BOOL)isNetworkAvailable
    {
        CFNetDiagnosticRef dReference;
        dReference = CFNetDiagnosticCreateWithURL (NULL, (__bridge CFURLRef)[NSURL URLWithString:@"www.apple.com"]);
    
        CFNetDiagnosticStatus status;
        status = CFNetDiagnosticCopyNetworkStatusPassively (dReference, NULL);
    
        CFRelease (dReference);
    
        if ( status == kCFNetDiagnosticConnectionUp )
        {
            return YES;
        }
        else
        {
            return NO;
        }
    }
    

 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: