Public Sub Ping(URL As String, ResultsType As String, Attempts As Int, Timeout As Int, Message As Boolean) As String
Dim P As Phone
Dim Option As String
Dim SB As StringBuilder : SB.Initialize
If Message = True Then ProgressDialogShow("Pinging " & URL)
If ResultsType = PING_TYPE_REPORT Then Option = "-v "
If ResultsType = PING_TYPE_SUMMARY OR ResultsType = PING_TYPE_STATUS Then Option = "-q "
P.Shell("ping -c " & Attempts & " -W " & Timeout & " " & Option & URL, Null, SB, Null)
ProgressDialogHide
If SB.Length = 0 OR SB.ToString.Contains("Unreachable") Then Return "Host unreachable"
Log(SB.ToString)
If ResultsType <> "Status" Then
Return SB.ToString
Else
Return "Host online"
End If
End Sub