hi,all:
I use DelimiterBasedFrameDecoder and ByteToMessageDecoder to decode my
message in TCP keepalive.
the server code:
bossGroup = new NioEventLoopGroup(1)
workerGroup = new NioEventLoopGroup
val bootstrap = new ServerBootstrap()
bootstrap.group(bossGroup, workerGroup)
.channel(classOf[NioServerSocketChannel])
.option[Integer](ChannelOption.SO_BACKLOG, 10000)
.option[java.lang.Boolean](ChannelOption.TCP_NODELAY, true)
.option[java.lang.Boolean](ChannelOption.SO_KEEPALIVE, true)
.childHandler(new ChannelInitializer[SocketChannel]() {
override def initChannel(ch: SocketChannel): Unit = {
val p = ch.pipeline
p.addLast(sslCtx.newHandler(ch.alloc))
val delimiter = Unpooled.copiedBuffer(Const.delimiter)
p.addLast(new DelimiterBasedFrameDecoder(204800, delimiter))
p.addLast(new ServerMsgDecoder)
p.addLast(new ServerMsgEncoder)
p.addLast(new ServerHandler)
}
})
ServerMsgDecoder extends from ByteToMessageDecoder.
But when I run my application, sometimes it will has some problem,the
ServerMsgDecoder loop process the same one message
forever, and then my server is abnormal.
05-22 23:49:37.784 INFO ServerMsgDecoder - == 4^X�^@^@^@^M1463931910119
05-22 23:49:37.784 INFO ServerMsgDecoder - == 4^X�^@^@^@^M1463931910119
05-22 23:49:37.784 INFO ServerMsgDecoder - == 4^X�^@^@^@^M1463931910119
05-22 23:49:37.784 INFO ServerMsgDecoder - == 4^X�^@^@^@^M1463931910119
05-22 23:49:37.784 INFO ServerMsgDecoder - == 4^X�^@^@^@^M1463931910119
05-22 23:49:37.784 INFO ServerMsgDecoder - == 4^X�^@^@^@^M1463931910119
05-22 23:49:37.784 INFO ServerMsgDecoder - == 4^X�^@^@^@^M1463931910119
05-22 23:49:37.784 INFO ServerMsgDecoder - == 4^X�^@^@^@^M1463931910119
..........
..........
..........more and more same message
the '4^X�^@^@^@^M1463931910119' is in.toString which is the param of decode
method in ServerMsgDecoder extends ByteToMessageDecoder
override def decode(
ctx: ChannelHandlerContext,
in: ByteBuf, out: util.List[AnyRef]
)
can someone help me? what happend? it caused by tcp packet splicing?
--
You received this message because you are subscribed to the Google Groups
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/netty/cbe86bb5-2215-4319-924c-44ab97c0ace3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.