' __ __ _ _ _ _
' \ \ / / ___ | |__ ___ (_) __| | ___ ___ | |_ ___ _ __ _ _
' \ \ /\ / / / _ \ | '_ \ / __| | | / _` | / _ \ / __| | __| / _ \ | '__| | | | |
' \ V V / | __/ | |_) | \__ \ | | | (_| | | __/ \__ \ | |_ | (_) | | | | |_| |
' \_/\_/ \___| |_.__/ |___/ |_| \__,_| \___| |___/ \__| \___/ |_| \__, |
' |___/
'
Public Sub isInternetAvailable As ResumableSub
Dim net As ServerSocket
net.Initialize(0, "")
Log("My IP: " & net.GetMyIP & " - Wifi IP: " & net.GetMyWifiIP)
If net.GetMyIP = "127.0.0.1" Then Return False ' this is the local host address
If Not( ph.GetDataState.EqualsIgnoreCase("CONNECTED") ) And net.GetMyWifiIP = "127.0.0.1" Then Return False
Dim j As HttpJob
j.Initialize("", Me)
j.GetRequest.Timeout = 5000
j.PostString(getRemoteUrl, "action=ping")
Wait For (j) JobDone (j As HttpJob)
If j.Success Then
Log("isInternetAvailable=" & j.GetString)
Return j.GetString.Trim.StartsWith("OK")
Else
Return False
End If
End Sub
'
Public Sub getServerVersionName(timeout As Int) As ResumableSub
Dim j As HttpJob
j.Initialize("", Me)
j.GetRequest.Timeout = timeout
j.PostString(getRemoteUrl, "action=ping")
Wait For (j) JobDone (j As HttpJob)
If Not(j.Success) Then Return ""