I'm having some problems with netty fragmentation of data.
My server accepts connection from client. The client
sends different message types. Theses messages tell the length of
the payload in the first 2 bytes.
An example:
Message 1
[00 21][21 bytes of payload]
Message 2
[00 25][23 bytes of payload]
Message 1
[00 80][80 bytes of payload]
Count:1,Messnger:John Doe1, Message:"I can tell you something";
Count:1,Messnger:John Doe2, Message:"What do you have to tell me";
Count:1,Messnger:John Doe3, Message:"Always be reading and teaching";
Message 1
Message 2
Message 3
Message 4
Message 5
Message 1
Message 2
Message 4
It sounds like there might be a problem in how you are processing the messages. It is very possible that you are getting partial messages or even multiple messages in a single channelRead
event.
I suggest looking into LengthFieldBasedFrameDecoder and adding that before your ServerHandler. It should help simplify message processing for you.