Netty代理示例中ctx.write(Unpooled.EMPTY

编程入门 行业动态 更新时间:2024-10-25 07:31:34
Netty代理示例中ctx.write(Unpooled.EMPTY_BUFFER)的用途是什么(What's the purpose of ctx.write(Unpooled.EMPTY_BUFFER) in Netty proxy example)

在Netty 代理示例的 HexDumpProxyBackendHandler中, channelActive方法的代码如下:

public void channelActive(ChannelHandlerContext ctx) { ctx.read(); ctx.write(Unpooled.EMPTY_BUFFER); }

我的问题是ctx.write(Unpooled.EMPTY_BUFFER)的目的是什么? 在通道激活后是否需要发送空的TCP消息帧?

In HexDumpProxyBackendHandler of Netty proxy example , the code of the method channelActive likes following:

public void channelActive(ChannelHandlerContext ctx) { ctx.read(); ctx.write(Unpooled.EMPTY_BUFFER); }

My question is what's the purpose of ctx.write(Unpooled.EMPTY_BUFFER)? Is it necessary to send an empty TCP message frame after the channel active?

最满意答案

没有理由,这很可能是错过了被删除。 我将清理示例以将其删除。 谢谢你让我们知道

There is not reason and this was most likely missed to be removed. I will clean up the example to remove it. Thanks for let us know

更多推荐

本文发布于:2023-08-05 07:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1430249.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:示例   ctx   Netty   EMPTY   Unpooled

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!