Created
June 20, 2014 07:47
-
-
Save cemolcay/45f9649c58796c92a3cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#include "unistd.h" | |
//#include "netdb.h" | |
- (BOOL)isNetworkAvailable { | |
char *hostname; | |
struct hostent *hostinfo; | |
hostname = "google.com"; | |
hostinfo = gethostbyname (hostname); | |
if (hostinfo == NULL){ | |
NSLog(@"-> no connection!\n"); | |
return NO; | |
} | |
else{ | |
NSLog(@"-> connection established!\n"); | |
return YES; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment