Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8299666

PingThis.java fails with java.net.SocketException: Socket is not connected

XMLWordPrintable

      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.

            msheppar Mark Sheppard
            msheppar Mark Sheppard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: