0

InetAddress.isReachable(NetworkInterface , int ttl, int timeOut) return true if the specific address is reachable in number of hops from ttl, other wise false.

Can I also know from which IP address it got the success or failure message? I meant can I have the IP of intermediate hops from which isReachable gets success or failure resposne.

Adi GuN
  • 1,244
  • 3
  • 16
  • 38
  • Keep in mind that routes change often. Even if you determined the route tree the next time you made the call you would likely get a different answer. At least on a WAN, any answer you get needs to be treated with a grain of salt. – Chris M. Jul 19 '13 at 17:31
  • Yeah I get it. But still I wanted to see the performance from customer end. – Adi GuN Jul 19 '13 at 18:19

1 Answers1

0

The manual says;

A typical implementation will use ICMP ECHO REQUESTs if the privilege can be obtained, otherwise it will try to establish a TCP connection on port 7 (Echo) of the destination host.

Basically, no. As TCP/IP is designed, you're in no way guaranteed to get hop-by-hop reachability information by using normal ICMP/TCP transmissions, so there is no reliable way to get that information.

The "traceroute" command can get semi reliable information on a hop by hop basis by setting TTL on the packets it sends, but isReachable is a "quick and dirty" way to check reachability and does not use this technique.

Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294