KtorUdpTransport

A UDP DatagramTransport on ktor-network, for coap on the JVM (and Android) and Apple platforms.

Peers are reported as Endpoint.Udp with the address in dev.kcoap.transport.IpLiteral canonical form, never by host name, so responses match requests by endpoint equality. Datagrams from addresses that are not IP (none exist on UDP sockets) are dropped. maxDatagramSize is what the CoAP layer may send; RFC 7252 §4.6 recommends 1152 bytes when the path MTU is unknown, which the default follows. Received datagrams may be larger.

val transport = KtorUdpTransport.bind(port = 5683)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The address and port the socket is bound to.

Link copied to clipboard
open override val maxDatagramSize: Int

Functions

Link copied to clipboard
open suspend override fun close()
Link copied to clipboard
open suspend override fun receive(): DatagramEvent
Link copied to clipboard
open suspend override fun send(to: Endpoint, datagram: ByteArray)
Link copied to clipboard
open override fun toString(): String