Netty defines two methods for channels: isOpen() and isConnected(), but the Javadoc does not really explain the difference between both and it is not self-explanatory. Can anyone clarify?
Is the following true?
-) An open channel is always connected
-) A connected channel does not mean one can use it to communicate, it must be open too
-) UDP-like channels are never connected
Thanks.
Netty Channel Channel is a component providing users a ways to process I/O operations, such as read and write. A ChannelPipeline encapsulates a series of ChannelHandler instances as two-way linked list. Inbound and outbound events that flow through a channel can be intercepted by the ChannelPipeline.
That's incorrect, a channel can be open and not connected, but a connected channel is necessarily open.
You can send data to an open channel that is not connected for connectionless transports using the write
method that takes a SocketAddress
as a parameter. Otherwise the channel needs to already be open and connected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With