Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

check connection c#

public static bool CheckForInternetConnection()
{
    try
    {
        using (var client = new WebClient())
            using (client.OpenRead("http://google.com/generate_204")) 
                return true; 
    }
    catch
    {
        return false;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #connection
ADD COMMENT
Topic
Name
1+8 =