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

bind

fun bind(local: SocketAddress?): CoroutineDatagramChannel (source)

Overrides CoroutineNetworkChannel.bind

Binds the channel's socket to a local address.

This method is used to establish an association between the socket and a local address. Once an association is established then the socket remains bound until the channel is closed. If the local parameter has the value null then the socket will be bound to an address that is assigned automatically.

Parameters

local - The address to bind the socket, or null to bind the socket to an automatically assigned socket address.

Exceptions

AlreadyBoundException - If the socket is already bound.

UnsupportedAddressTypeException - If the type of the given address is not supported.

ClosedChannelException - If the channel is closed.

IOException - If some other I/O error occurs.

SecurityException - If a security manager is installed and it denies an unspecified permission. An implementation of this interface should specify any required permissions.

Return
This channel.