Class Ping

All Implemented Interfaces:
Message

public class Ping extends BaseMessage
See BIP31 for details.

Instances of this class are immutable.

  • Method Details

    • read

      public static Ping read(ByteBuffer payload) throws BufferUnderflowException, ProtocolException
      Deserialize this message from a given payload.
      Parameters:
      payload - payload to deserialize from
      Returns:
      read message
      Throws:
      BufferUnderflowException - if the read message extends beyond the remaining bytes of the payload
      ProtocolException
    • of

      public static Ping of(long nonce)
      Create a ping with a nonce value. Only use this if the remote node has a protocol version greater than 60000
      Parameters:
      nonce - nonce value
      Returns:
      ping message
    • random

      public static Ping random()
      Create a ping with a random nonce value. Only use this if the remote node has a protocol version greater than 60000
      Returns:
      ping message
    • bitcoinSerializeToStream

      public void bitcoinSerializeToStream(OutputStream stream) throws IOException
      Description copied from class: BaseMessage
      Serializes this message to the provided stream. If you just want the raw bytes use BaseMessage.serialize().
      Specified by:
      bitcoinSerializeToStream in class BaseMessage
      Throws:
      IOException
    • hasNonce

      @Deprecated public boolean hasNonce()
      Deprecated.
      returns true
    • nonce

      public long nonce()
    • pong

      public Pong pong()
      Create a Pong reply to this ping.
      Returns:
      pong message