Skip to content

Instantly share code, notes, and snippets.

@AungWinnHtut
Created August 3, 2016 06:44
Show Gist options
  • Save AungWinnHtut/586ade01adc666eacf7247dacee1e090 to your computer and use it in GitHub Desktop.
Save AungWinnHtut/586ade01adc666eacf7247dacee1e090 to your computer and use it in GitHub Desktop.
Public Function IsConnectionAvailable() As Boolean
Dim objUrl As New System.Uri("http://google.com")
Dim objWebReq As System.Net.WebRequest
objWebReq = System.Net.WebRequest.Create(objUrl)
Dim objresp As System.Net.WebResponse
Try
objresp = objWebReq.GetResponse
objresp.Close()
objresp = Nothing
Return True
Catch ex As Exception
objresp = Nothing
objWebReq = Nothing
Return False
End Try
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment