The problem here is that if I disconnect the network cable for "mymachine" the add.isReachable(3000) retuns true.
I disconnect or unplug the network cord at runtime as I have placed the code inside a while(true) loop.
Can anybody expalin me why the method is returning true and not false.
Also if there are other ways to achieve this then let me know.
Thanks in advance for help!!
posted 7 years ago
I believe it first checks the local DNS cache.
A more reliable way would be to ping or traceroute(if a firewall doesn't drop it) or try to connect. Other than that you will need raw packets, or use another program such as nmap or hping2.
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra