I have two devices connected to my network. I've made a simple Android application to detect connected devices using ping.
The application runs in the device with the IP 192.168.1.14.
The code below is used to ping IP addresses (I've tried all available methods, I get the same results ):
String ipAddress = "192.168.1.";
for (int i=1; i < 255; i++){
String ip = ipAddress + i;
InetAddress inet = InetAddress.getByName(ip);
if (inet.isReachable(300)){
Log.d(TAG, ip + " is reachable.");
}
}
I've got the following results:
192.168.1.1 is reachable.
192.168.1.14 is reachable.
But I didn't get 192.168.1.15