Companion

The server's constants: COMMON_LISTEN_PORT, the receive-buffer bounds and default (MAX_UDP_PAYLOAD_BYTES, MIN_RECEIVE_BUFFER_BYTES, DEFAULT_RECEIVE_BUFFER_BYTES) and DISABLED_IDLE_TIMEOUT.

Properties

Link copied to clipboard
const val COMMON_LISTEN_PORT: Int = 9998

Well-known port clients send their Iam handshake to, and over which every client's traffic (data, broadcasts, keepalives) is multiplexed.

Link copied to clipboard

Default receiveBufferBytes - equal to MAX_UDP_PAYLOAD_BYTES, so by default no well-formed datagram is ever truncated on receive.

Link copied to clipboard

Default idleTimeoutMillis: 0, i.e. idle-connection detection is off. When enabling it, a value around 3x the ~20 s keepalive cadence (~60_000) is a sane starting point.

Link copied to clipboard
const val MAX_UDP_PAYLOAD_BYTES: Int = 65507

Maximum UDP payload over IPv4 (65535 - 8 UDP - 20 IP): the largest a receiveBufferBytes may be, and the size at which no datagram is ever truncated on receive.

Link copied to clipboard
const val MIN_RECEIVE_BUFFER_BYTES: Int = 512

Smallest permitted receiveBufferBytes. Comfortably holds every handshake / keepalive token and a small application payload with headroom; a buffer below this is almost certainly a misconfiguration.