Hi ,
I am developing an aplication which needs to download some data from webserver.So i need to first ping to the web server to check whether the service is available after checking the internet connectivity .I used the following code to check server availability
` BOOL success = NO;
const char *host_name = [@"http://192.168.1.7:8080/TestWeb/webresources/"
cStringUsingEncoding:NSASCIIStringEncoding];
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL,
host_name);
SCNetworkReachabilityFlags flags;
success = SCNetworkReachabilityGetFlags(reachability, &flags);
BOOL isAvailable = success && (flags & kSCNetworkFlagsReachable) && !(flags & kSCNetworkFlagsConnectionRequired);
return isAvailable;
`
where my server is uploaded locally.But this code always return an invalid result,but it works correctly if i gave some exixting sites like google.com.Please let me know whats i am doing wrong..