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

trySend

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

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

Parameters

src - The buffer containing the datagram to be sent.

target - The address to which the datagram is to be sent.

Exceptions

ClosedChannelException - If the channel is closed.

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

ClosedByInterruptException - If another thread interrupts the current thread while the send 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 number of bytes sent, which will be zero if the channel was not ready to send.