While a go I asked how to ping server and get respond.
I've got some answer but it only tells me that server is responding.
How to get similar thing as it on win shell cmd with the number of packets received or lost and time of respond?
B4X:
Sub Ping(ipaddress As String)
Log("started")
Dim shl As Shell
Dim lstParams As List: lstParams.Initialize
Try
Dim os As String = GetSystemProperty("os.name", "").ToLowerCase
If os.Contains("win") Then
Log("Windows")
'Windows
lstParams.Add("-n")
Else
'Linux and Mac
lstParams.Add("-c")
End If
lstParams.Add("1")
lstParams.Add(ipaddress)
shl.Initialize("shl", "ping", lstParams)
shl.WorkingDirectory = File.DirApp
shl.Run(-1)
Catch
Log(LastException.Message)
End Try
End Sub
Are you looking for the "feedback" from a successful ping command?
Did you add something like the following to your code?
B4X:
Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut AsString, StdErr AsString)
If Success AND ExitCode = 0 Then
Log("Success")
Log(StdOut)
Else
Log("Error: " & StdErr)
EndIf
ExitApplication
End Sub
Are you aware that many installations don't allow reply to a ping command?
have a look at RegEx for a powerful method to extract info from a non-structured text (i.e. your StdOut as retuned by jshell after executing the ping command).
AFAIK, ping command works on a single address at time. You could list a few addresses in a global list, process on item at time (the top one), remove it an so on while you ha ve items in the list.