I used this question to check whether the internet connection (WiFi \ 3G) is active.
It's working pretty good, but there's a small problem.
When I turn off the internet, the app gives the alert that Internet is down; but when i turn it on again, until the connection is definitely up, it says that the host is down while actually is up and in fact, after a while, it logs that is up.
I would like to know what could i do to let that message appear only when the server is actually down and not while reconnecting to the internet!
Here's my code
-(void) checkNetworkStatus:(NSNotification *)notice
{
    NetworkStatus internetStatus = [internetReachable currentReachabilityStatus];
    NetworkStatus hostStatus = [hostReachable currentReachabilityStatus];
    if (internetStatus == NotReachable){
        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Reloading Failed" message: @Seems like you're offline! \n Some features, such as updating contents and downloading screenshots won't be available while you're offline.\nNavigate to Settings > Wi-Fi to connect to the Internet and enjoy those features!") delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Ok", nil];
        [alert show];
        [alert release];
        NSLog(@"offline");
    }
    else if (internetStatus == ReachableViaWiFi || internetStatus == ReachableViaWWAN){
        NSLog(@"online");
        if (hostStatus == NotReachable)
        {   NSLog(@"Server offline");
            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Reloading Failed" message:@"Seems like there's a communication problem with the remote network. \n Please try again in a while!" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Ok", nil];
            [alert show];
            [alert release];
        }
        else if (hostStatus == ReachableViaWWAN || hostStatus == ReachableViaWiFi){
            NSLog(@"server online");
           //download data from remote server 
        }
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetworkStatus:) name:kReachabilityChangedNotification object:nil];
    internetReachable = [[Reachability reachabilityForInternetConnection] retain];
    [internetReachable startNotifier];
    hostReachable = [[Reachability reachabilityWithHostName: @"www.mywebsite.com"] retain];
    [hostReachable startNotifier];
Any ideas?
 
     
    