ping

suspend fun ping(peer: Endpoint): Boolean(source)

Sends a CoAP ping. To a datagram peer (RFC 7252 §4.3) an Empty Confirmable message, which a live peer answers with a Reset: true if it answered, false if it never did within MAX_TRANSMIT_WAIT. To a reliable peer (RFC 8323 §5.4) a Ping on its connection, opened if needed: true if the Pong came within ReliableTransportConfig.pingTimeout, false if not or if the connection failed.

Throws

with CoapException.Reason.TRANSPORT_UNAVAILABLE when the endpoint has no transport for peer, or like closeCause once the endpoint is closed, also when it closes while the ping waits for its connection or its answer, whatever the transport.


suspend fun ping(peer: Endpoint, custody: Boolean): Boolean(source)

Like ping. To a reliable peer, custody asks it to answer only once it has processed every request it received before the Ping (RFC 8323 §5.4.1); datagram pings ignore it.