keepAlive

abstract fun keepAlive(): Result<Unit>(source)

Sends one minimal keepalive datagram to peer to keep its NAT mapping warm. A one-shot: the caller schedules it (recommended ~20 s idle cadence). Owns no timer or thread. For a library-managed cadence use startKeepAlive.

Direction caveat: this handle lives on the server side, so this is a server->client datagram. It refreshes the mapping timer on endpoint-independent-filtering (full-cone / restricted-cone) NATs and lets the server verify its send path, but it does not reliably refresh port-restricted or symmetric NATs. The authoritative keepalive must be sent by the client on its own socket every ~20 s.

Return

Result.success if the datagram was sent, or the failure that prevented it