1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

InetAddress.isReachable is reported reliable on mac and recent java versions

Refactored NetUtils.isReachable to two functions:
isReachableByEcho and isPortOpen
If the first one will fail, the second one will be used
This commit is contained in:
Federico Fissore
2015-02-19 09:34:32 +01:00
parent 3fec636b29
commit 0990f98b14
2 changed files with 28 additions and 4 deletions

View File

@ -75,10 +75,7 @@ public class NetworkDiscovery implements Discovery, ServiceListener, cc.arduino.
ports.add(0, 22);
}
boolean reachable = false;
for (Integer port : ports) {
reachable = reachable || NetUtils.isReachable(inetAddress, port);
}
boolean reachable = NetUtils.isReachable(inetAddress, ports);
if (!reachable) {
boardPortIterator.remove();
}