0
的預計量。我確信這個頻道是可寫的。的Netty沒有收到消息
這是我的測試代碼:
Sending the messages
Channel channel = PluginMessageClient.getClient().getChannel();
for(int i = 0; i < 10; i++)
channel.writeAndFlush(Unpooled.wrappedBuffer(new byte[]{1}));
Receiving the messages
public class PluginMessageServerHandler extends SimpleChannelInboundHandler<ByteBuf>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception
{
System.out.println("test"); //Being printed 1-3 times (varies every time I run the message sending method).
}
}
任何想法,爲什麼發生這種情況?
嘗試使用緩衝區並打印它,併發送不同的消息。你得到哪些消息? – igreen