net-coroutines / org.apache.tuweni.net.coroutines / CoroutineDatagramChannel

CoroutineDatagramChannel

class CoroutineDatagramChannel : CoroutineByteChannel, ScatteringCoroutineByteChannel, GatheringCoroutineByteChannel, CoroutineNetworkChannel (source)

A co-routine based datagram-oriented network channel.

Properties

isConnected

Indicates whether this channel is connected.

val isConnected: Boolean

remoteAddress

Get the remote address to which this channel is connected.

val remoteAddress: SocketAddress

Functions

bind

Binds the channel's socket to a local address.

fun bind(local: SocketAddress?): CoroutineDatagramChannel

close

Closes this channel.

fun close(): Unit

connect

Connect this channel.

fun connect(remote: SocketAddress): CoroutineDatagramChannel

disconnect

Disconnects this channel.

fun disconnect(): CoroutineDatagramChannel

receive

Receives a datagram via this channel.

suspend fun receive(dst: ByteBuffer): SocketAddress

send

Sends a datagram via this channel.

suspend fun send(src: ByteBuffer, target: SocketAddress): Int

tryReceive

Receives a datagram via this channel, if one is immediately available.

fun tryReceive(dst: ByteBuffer): SocketAddress?

trySend

Sends a datagram via this channel, if it can be sent immediately.

fun trySend(src: ByteBuffer, target: SocketAddress): Int

Companion Object Functions

open

Opens a datagram channel.

fun open(group: CoroutineChannelGroup = CommonCoroutineGroup): CoroutineDatagramChannel