Hello,
I am using this code to test for an internet connection. As my application will have to login to a web server. However, if the user internet connection was to fail or cable pulled out. I will have to notify the user.
The only way I think I can test for an Internet connection is to ping www.google.com. So I have a used a server timer which I have set for 1/2 second and in the lapsed event it will call this ping function. If the ping returns false. Then my app will take appropriate action.Code:' Ping www.google.com to check if the user has a internet connection. Public Function PingTest() As Boolean Dim ping As New Ping() Dim pingStatus As PingReply = ping.Send(IPAddress.Parse("208.69.34.231")) If pingStatus.Status = IPStatus.Success Then Return True Else Return False End If End Function
Do you think using google as a way to test an Internet connect is a good thing. If google was to fail, then my app would not function. Is polling 1/2 second to much or too little? Just wondering about my whole idea if it is good or not?
Many thanks,




Reply With Quote