Class Ping


  • public final class Ping
    extends Object
    A locally-originated ping.
    • Method Detail

      • roundTripTime

        public long roundTripTime()
                           throws InterruptedException
        Returns the round trip time for this ping in nanoseconds, waiting for the response to arrive if necessary. Returns -1 if the response was canceled.
        Throws:
        InterruptedException
      • roundTripTime

        public long roundTripTime​(long timeout,
                                  TimeUnit unit)
                           throws InterruptedException
        Returns the round trip time for this ping in nanoseconds, or -1 if the response was canceled, or -2 if the timeout elapsed before the round trip completed.
        Throws:
        InterruptedException