I am trying to get the internet (Connected or disconnected) status in my VB.NET application. I am trying the following simple function which is running fine.
Private Function CheckInternetStatus() As Boolean
Dim IPhost As System.Net.IPHostEntry = System.Net.Dns.GetHostEntr
I am calling this function from a Timer after every 30 seconds to check the status of internet connected or disconnected.
Dim InternetStatus As Boolean = CheckInternetStatus()
If InternetStatus = True Then 'Internet is connected
Else 'Internet is disconnected
The problem is that whenever I am disconnected the function takes a few seconds(almost 25 seconds) to return False and during this time the User Interface of my application freezes. How can I resolve this freezing of my User Interface? I think creating a separate thread for this might be the way to go but I am unable to find a good solution.
So my requirements are
1) Get status of internet
2) Get the internet downtime
3) Notified when specific time(say 2 min.) has passed and I have not connected to the internet.
(I have implemented all of this functionality using the function above and a timer control but I want it using threading)