I'm trying to get the INetAddress with the following code:
try
{
var address = InetAddress.GetByName ("google.com");
System.Diagnostics.Debug.WriteLine (address);
}
catch (Java.Net.UnknownHostException)
{
System.Diagnostics.Debug.WriteLine ("not working");
}
But it always prints "not working". I checked and my internet connection is fine. I don't know why this is happening. Thank's in advance.
I could solve this by using
AsyncTask
.here is my implementation
to get result you need to do next
One more option to check inet connection. All you need is change
isInternetReachable
inConnectionCheckAsyncTask
with next code