I am currently working in an application that scan the all the connected devices on my network.
I have tried with ping from 1 to 254 ip’s by changing the last subnet , but some of the devices doesn’t responding to ping. In android having similar app like this to scan devices in network : https://github.com/aaronjwood/PortAuthority , I need to find the all the available devices in my network. Kindly give idea or solution to achieve this.
if let ipAddress = getAllIPsInSameNetwork(myIP: myIP, subnetMask: "255.255.255.0") {
ipAddress.forEach { ip in
group.enter()
var pingProvider : PingProvider? = PingProvider()
pingProvider?.startPinging(host: ip, pingCount: 1) { data, error in
group.leave()
if data?.packetLoss != 100{
print("Avaialble",ip)
}
pingProvider = nil
}
}
}