Created
January 3, 2012 19:26
-
-
Save devkral/1556468 to your computer and use it in GitHub Desktop.
internet connection test
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
/** Checks internet connection by making a dns request. | |
* The returned result is the error number of | |
* the dns request attempt. | |
* zero = connection available | |
* Licence: do what you want with this code snippet | |
*/ | |
#include <netdb.h> | |
int networkdnstest(char *testdnsname) | |
{ | |
struct addrinfo *result; | |
int error=getaddrinfo(testdnsname,NULL,NULL,&result); | |
return error; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment