Hi,
Is there any way of creating a DHCP server with B4j ?
and if there a better way of getting the IP adresses which are alive on your subnet. I am using ARP but it is not reliable
then I have to use
Thank you
Is there any way of creating a DHCP server with B4j ?
and if there a better way of getting the IP adresses which are alive on your subnet. I am using ARP but it is not reliable
B4X:
Dim sh1 As Shell
sh1.Initialize("sh1","arp",Array("-d"))
sh1.Run(1000)
Dim sh1 As Shell
sh1.Initialize("sh1","arp",Array("-a"))
sh1.Run(2000)
Log("alive")
then I have to use
B4X:
Sub sh1_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Dim caplet As String
caplet=su.UpperCase(StdOut)
File.WriteString(File.DirApp, "1.txt", caplet)
Dim List1 As List
List1 = File.ReadList(File.DirApp, "1.txt")
For i = 2 To List1.Size - 1
If su.ContainsSeq(List1.Get(i),"192.168.10") And su.ContainsSeq(List1.Get(i),"DYNAMIC") Then
Dim ipaddress As String = su.Substring(List1.Get(i),2,16)
Dim MACAddress As String = su.Substring(List1.Get(i),24,41)
Log("MAC Address of Alive "&MACAddress)
Log("IP address of alive "&ipaddress)
Dim ip As Int = su.SubstringAfterLast(ipaddress,".")
Log(" IP last digits "&ip)
If ip < 200 Then
Wait For(pingesp(ipaddress)) Complete (result As Boolean)
End If
If result=True Then
Dim whereas As Map
whereas.Initialize
whereas.Put("macaddress",MACAddress)
DBUtils.UpdateRecord(sql1,"dfip","alive",1,whereas)
End If
reloadtables
End If
Next
End Sub
Thank you
Last edited: