How to using ByteToMessageDecoder correctly

27 views
Skip to first unread message

Daniel

unread,
Nov 8, 2019, 2:50:25 AM11/8/19
to Netty discussions
Hello, everyone,
     I have developed a project that using ByteToMessageCodec to handle sticky and unpacking TCP/IP message. Although it works , but I am confused about how to Netty Framework to judge whether a ByteBuf should be dropped or accumulated.

    For example, in line 38 and 75,  it should be accumulated to form a complete data, meanwhile, in line 46, it should be dropped, because it is a invalid package. I used the same way to code it "return".  I think it should be coded differently.

Thanks in advanced. 

 



截屏2019-11-0319.43.15.png


Reply all
Reply to author
Forward
0 new messages