Sub IsOnline As Boolean
'Requires Phone Library
Dim p As Phone
Dim Response, Error As StringBuilder
Response.Initialize
Error.Initialize
Try
'Ping Google DNS - if you can't reach this you are in serious trouble (or in China)!
p.Shell("ping -q -c 1 -W 2 8.8.8.8",Null,Response,Error)
If Error.ToString="" Then
If Response.ToString.Contains("100% packet loss") Then
Log("Ping ran but no response " & Response.ToString)
Return False
End If
Return True
Else
Return False
End If
Catch
Log("Error pinging Google DNS: " & Error.ToString)
Return False
End Try
End Sub