ConnectedDatagramSocket

Represents a connected datagram socket.

Functions

Link copied to clipboard
abstract fun attachForReading(channel: ByteChannel): WriterJob

Attach channel for reading so incoming bytes appears in the attached channel. Only one channel could be attached

Link copied to clipboard
abstract fun attachForWriting(channel: ByteChannel): ReaderJob

Attach channel for writing so bytes written to the attached channel will be transmitted Only one channel could be attached

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
open override fun dispose()
Link copied to clipboard
open suspend fun receive(): Datagram

Receive a datagram.

Link copied to clipboard
open suspend fun send(datagram: Datagram)

Send datagram.

Properties

Link copied to clipboard
abstract val incoming: ReceiveChannel<Datagram>

Incoming datagrams channel

Link copied to clipboard
abstract val localAddress: NetworkAddress

Local socket address. Could throw an exception if no address bound yet.

Link copied to clipboard
abstract val outgoing: SendChannel<Datagram>

Datagram outgoing channel.

Link copied to clipboard
abstract val remoteAddress: NetworkAddress

Remote socket address. Could throw an exception if the peer is not yet connected or already disconnected.

Link copied to clipboard
abstract val socketContext: Job

Represents a socket lifetime, completes at socket closure