When PingThis.java is run as root on macosx, it fails with SocketException: Socket not connected. This is due to the native execution of ping4 in Inet4AddresssImpl. This is a change in behaviour at the OS level from Darwin kernel, which will fail with SocketException: no route to host, which is a more appropriate failure.
When executing as root, will cause the call flow to enter ping4, using a raw socket and an ICMP echo message. The sendto os call accepts the 0.0.0.0 as a bone fide dest address (which it is not) and returns. No response is received and a second attempt is made to send the ICMP echo message, this results in an error of 57 == ENOTCONN, which is semantically meaningless in this scenario.
When executing as root, will cause the call flow to enter ping4, using a raw socket and an ICMP echo message. The sendto os call accepts the 0.0.0.0 as a bone fide dest address (which it is not) and returns. No response is received and a second attempt is made to send the ICMP echo message, this results in an error of 57 == ENOTCONN, which is semantically meaningless in this scenario.
- relates to
-
JDK-8074573 PingThis.java fails intermittently with "java.net.SocketException: No route to host"
- Open