有关高水位问题,数据不能刷出 netty 缓存 #11833
Replies: 4 comments 3 replies
-
达到高水位后缓冲满了,就是没法write了呀。你的意思是直接调channel.flush()也发不出去? |
Beta Was this translation helpful? Give feedback.
-
对的,,可以通过我粘贴的代码,测试一下,
|
Beta Was this translation helpful? Give feedback.
-
Sorry but I can only help if you use English |
Beta Was this translation helpful? Give feedback.
-
我之前看过讲述类似问题的文章,大致思想是这样的 你应该监听, 监听 通俗的理解就是,服务端的缓存满了。就不再处理客户端数据,(在recv buf满了后,客户端也没法发送数据)直到服务端缓存队列可用了,在重新开始处理客户端的请求。 |
Beta Was this translation helpful? Give feedback.
-
//Server code
`public class EchoServer {
}
`
//server handle
`public class EchoServerHandle extends ChannelInboundHandlerAdapter {
}`
// client code
`public class EchoClient {
}
`
// client handle
`
public class EchoClientHandle extends ChannelInboundHandlerAdapter {
public static final AtomicInteger num = new AtomicInteger(0);
}
`
//MyDecoder code
`public class MyDecoder extends LengthFieldBasedFrameDecoder {
}
`
/ / description
The server starts, the client starts, and when the data is sent to the high water level, the data is not sent
You need to call this code, force a refresh,
((AbstractNioChannel) ctx.channel()).unsafe().forceFlush();
Am I using it incorrectly?
Beta Was this translation helpful? Give feedback.
All reactions