TransmissionParameters

class TransmissionParameters(val ackTimeout: Duration = 2.seconds, val ackRandomFactor: Double = 1.5, val maxRetransmit: Int = 4, val nstart: Int = 1, val defaultLeisure: Duration = 5.seconds, val probingRate: Int = 1, val maxLatency: Duration = 100.seconds, val maxPayloads: Int = 10, val nonTimeout: Duration = ackTimeout, val nonReceiveTimeout: Duration = maxOf(nonTimeout * 2, nonTimeout * ackRandomFactor + 1.seconds), val nonMaxRetransmit: Int = maxRetransmit)(source)

The CoAP transmission parameters of RFC 7252 §4.8 and the time values derived from them (§4.8.2).

The defaults are the RFC's. §4.8.1 warns that decreasing ackTimeout or increasing nstart is only safe with congestion-control mechanisms that measure round-trip times; kcoap allows it for tests and controlled networks but does not add such mechanisms. Every endpoint that talks to another must use consistent values.

Constructors

Link copied to clipboard
constructor(ackTimeout: Duration = 2.seconds, ackRandomFactor: Double = 1.5, maxRetransmit: Int = 4, nstart: Int = 1, defaultLeisure: Duration = 5.seconds, probingRate: Int = 1, maxLatency: Duration = 100.seconds, maxPayloads: Int = 10, nonTimeout: Duration = ackTimeout, nonReceiveTimeout: Duration = maxOf(nonTimeout * 2, nonTimeout * ackRandomFactor + 1.seconds), nonMaxRetransmit: Int = maxRetransmit)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

ACK_RANDOM_FACTOR, at least 1.0 (§4.8.1).

Link copied to clipboard

ACK_TIMEOUT: the initial retransmission timeout is drawn from [ackTimeout, ackTimeout × ackRandomFactor].

Link copied to clipboard

DEFAULT_LEISURE (§8.2), for multicast responses; kept for completeness.

Link copied to clipboard

EXCHANGE_LIFETIME: MAX_TRANSMIT_SPAN + 2 × MAX_LATENCY + PROCESSING_DELAY, 247 s by default.

Link copied to clipboard

MAX_LATENCY: the longest a datagram is expected to be in transit.

Link copied to clipboard

MAX_PAYLOADS (RFC 9177 §7.2): the Non-confirmable Q-Block payloads sent back to back before waiting NON_TIMEOUT_RANDOM. It cannot be negotiated, so both peers must use the same value; a mismatch costs delays, not data.

Link copied to clipboard

MAX_RETRANSMIT: retransmissions of a Confirmable message before giving up.

Link copied to clipboard

MAX_RTT: 2 × MAX_LATENCY + PROCESSING_DELAY.

Link copied to clipboard

MAX_TRANSMIT_SPAN: first transmission to last retransmission, ACK_TIMEOUT × (2^MAX_RETRANSMIT − 1) × ACK_RANDOM_FACTOR.

Link copied to clipboard

MAX_TRANSMIT_WAIT: first transmission to giving up, ACK_TIMEOUT × (2^(MAX_RETRANSMIT+1) − 1) × ACK_RANDOM_FACTOR.

Link copied to clipboard

NON_LIFETIME: MAX_TRANSMIT_SPAN + MAX_LATENCY, 145 s by default.

Link copied to clipboard

NON_MAX_RETRANSMIT (RFC 9177 §7.2): how often a receiver asks for the same missing payload before it gives the body up. Defaults to maxRetransmit.

Link copied to clipboard

NON_PARTIAL_TIMEOUT (RFC 9177 §7.2): how long a partially received Q-Block body is kept, NON_TIMEOUT × (2^NON_MAX_RETRANSMIT − 1) × ACK_RANDOM_FACTOR + 2 × MAX_LATENCY + NON_TIMEOUT, 247 s by default.

Link copied to clipboard

NON_RECEIVE_TIMEOUT (RFC 9177 §7.2): how long a receiver waits for a missing payload before asking for it, doubled for every repeat. RFC 9177 §7.2 requires at least NON_TIMEOUT × ACK_RANDOM_FACTOR + 1 s, so that it outlasts the sender's NON_TIMEOUT_RANDOM. Defaults to 2 × NON_TIMEOUT (4 s, Table 3), or to that lower bound when it is larger, as it is when ackTimeout is below 2 s or ackRandomFactor above 1.5.

Link copied to clipboard

NON_TIMEOUT (RFC 9177 §7.2): the base of NON_TIMEOUT_RANDOM, the wait between two MAX_PAYLOADS sets. Defaults to ackTimeout, 2 s.

Link copied to clipboard
val nstart: Int

NSTART: simultaneous outstanding interactions per peer (§4.7).

Link copied to clipboard

PROBING_RATE in bytes per second: the average rate towards a peer that does not respond (§4.7). It bounds how long a Non-confirmable request occupies its NSTART slot.

Link copied to clipboard

PROCESSING_DELAY: set equal to ACK_TIMEOUT, as §4.8.2 assumes.

Functions

Link copied to clipboard
open override fun toString(): String