A selectable channel for datagram-oriented sockets.
Datagram channels are not a complete abstraction of network datagram
sockets. Binding and the manipulation of socket options must be done
through an associated DatagramSocket object obtained by
invoking the socket method. It is not possible to create
a channel for an arbitrary, pre-existing datagram socket, nor is it possible
to specify the DatagramSocketImpl object to be used by a
datagram socket associated with a datagram channel.
A datagram channel is created by invoking the open method
of this class. A newly-created datagram channel is open but not connected.
A datagram channel need not be connected in order for the send
and receive methods to be used. A datagram channel may be
connected, by invoking its connect method, in order to
avoid the overhead of the security checks are otherwise performed as part of
every send and receive operation. A datagram channel must be connected in
order to use the read and write methods, since those methods do not
accept or return socket addresses.
Once connected, a datagram channel remains connected until it is
disconnected or closed. Whether or not a datagram channel is connected may
be determined by invoking its isConnected method.
Datagram channels are safe for use by multiple concurrent threads. They
support concurrent reading and writing, though at most one thread may be
reading and at most one thread may be writing at any given time.
Datagram channels are not a complete abstraction of network datagram sockets. Binding and the manipulation of socket options must be done through an associated DatagramSocket object obtained by invoking the socket method. It is not possible to create a channel for an arbitrary, pre-existing datagram socket, nor is it possible to specify the DatagramSocketImpl object to be used by a datagram socket associated with a datagram channel.
A datagram channel is created by invoking the open method of this class. A newly-created datagram channel is open but not connected. A datagram channel need not be connected in order for the send and receive methods to be used. A datagram channel may be connected, by invoking its connect method, in order to avoid the overhead of the security checks are otherwise performed as part of every send and receive operation. A datagram channel must be connected in order to use the read and write methods, since those methods do not accept or return socket addresses.
Once connected, a datagram channel remains connected until it is disconnected or closed. Whether or not a datagram channel is connected may be determined by invoking its isConnected method.
Datagram channels are safe for use by multiple concurrent threads. They support concurrent reading and writing, though at most one thread may be reading and at most one thread may be writing at any given time.