Sub RunPing
Dim Command As String
Dim Result As Int
Dim Ph As Phone
Dim Adr As String
Dim Start As Int
Dim stop As Int
Dim M As Int
Command = File.Combine(File.DirInternalCache, "command")
Adr="192.168.1."
Start=1
stop=254
For M=Start To stop
File.WriteString(File.DirInternalCache, "command", "ping -w 1 -c 1 -n " & Adr & M & CRLF & "exit")
Dim StdOut, StdErr As StringBuilder
StdOut.Initialize
StdErr.Initialize
Result = Ph.Shell("sh", Array As String(Command), StdOut, StdErr)
Dim R As String
R=StdOut.ToString
If R.Contains("1 received") Then
Log(Adr & M & " On")
Else
Log(Adr & M & " Off")
End If
Next
End Sub