开发者

Difference between channel.isOpen() and channel.isConnected() in Netty?

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. Ca开发者_StackOverflow社区n 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜