Android Question Scanner IP - WiFi

MarcoRome

Expert
Licensed User
Longtime User
Hi all, again dont found the "best solution".
The Monster67 give me one solution ( Thank you again Monster :) ) that found about French Forum

http://www.basic4ppc.com/android/forum/threads/comment-scanner-les-ip-locales.14539/#post-82389

This is code:

B4X:
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

work without problem but is very slow.
Another solution ??
Thank you in advance
 
Top