I think the best way to check the availability of the host address is to check the results of the NSURL request.
NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:reqURL]]; NSURLResponse *resp = nil; NSError *error = nil; NSData *response = [NSURLConnection sendSynchronousRequest: theRequest returningResponse: &resp error: &error]; NSString *responseString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
Using this bit of code, if your device cannot reach the provided URL, it provides some error variable output, if it can access the URL request, the error is Nil.
Reachability gives a positive result, even if your URL packets can be routed from your device and never reach the host server.
Yugesh Shrestha Aug 13 '13 at 16:32 2013-08-13 16:32
source share