Could this code snippet return false despite availability of internet connection ?
private bool ConnectionIsOk()
{
try
{
using (var client = new WebClient())
using (var stream = client.OpenRead("http://www.google.com"))
{
return true;
}
}
catch
{
return false;
}
}
this part of code I use in my program , when my friend started my program he said that this function returned false despite availability of internet connection !! could this be true ? and when ?