I was wondering if anyone has used the isReachable() method from the
InetAddress class and could help me with a problem I'm having. Here's
I'm creating an InetAddress as shown below and checking to see if each
IP is reachable. Earlier I thought that this method was a kind of
"ping" and until now it has acted that way.
//Check to see if each device is connected
isReachable = new boolean[gtps.size()];
for (int i = 0; i < gtps.size(); i++)
InetAddress temp_addr = (InetAddress)IP_addresses.get(i);
isReachable[i] = temp_addr.isReachable(2000);
System.out.println("isReachable[" + i + "]: " + isReachable[i]);
JOptionPane.showConfirmDialog(null, "NetInterface " +
(String)Names.get(i) + " could not be found.", "Invalid IP",
When I run this code when the IP devices are connected, the isReachable
will return true. If they are disconnected, the value becomes false
(which is what made me believe this is some sort of ping function).
However, when I disconnect my computer from the network that the IP
values are on, isReachable will return true. Is there something
conceptually that I am missing about the method? I have considered the
fact that isReachable will return true if a device at that IP _could_
be reached even though it doesn't exist, but then disconnecting the
network should return false, right?
Any help in this matter would be greatly appreciated.
Thanks in advance,
|All times are GMT. The time now is 08:08 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.