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

tryReceive

fun tryReceive(dst: ByteBuffer): SocketAddress? (source)

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

Parameters

dst - The buffer into which the datagram is to be transferred.

Exceptions

ClosedChannelException - If the channel is closed.

AsynchronousCloseException - If another thread closes this channel while the receive operation is in progress.

ClosedByInterruptException - If another thread interrupts the current thread while the receive operation is in progress, thereby closing the channel and setting the current thread's interrupt status.

IOException - If some other I/O error occurs.

Return
The datagram's source address, or null if no datagram was available to be received.