Ping ICMP ping

Are there any methods for ping icmp (echo request) instead of using isReachable? isReachable establishes a TCP connection on port 7, and when I used wirehark, I did not see any ICMP packets for Window and ICMP type 3 on Linux (not type 8 and 0). Therefore, if anyone has suggestions or solutions, you could tell me. Thank you very much!

+4
source share
2 answers

ICMP tends to require administrative privileges, so a Java program running as a regular user cannot directly use ICMP.

The only workaround that comes to my mind is to create an external program to run the "ping" command provided by the OS and analyze its output.

+3
source

We were fortunate enough to use the Parallec library ( http://www.parallec.io/ ).

Before that, we launched the ping command-line utility provided by Linux using Runtime.exec ().

As mentioned above, isReachable will use ICMP if you run it as a privileged user, otherwise it uses TCP.

0
source

Source: https://habr.com/ru/post/1389923/


All Articles