buffer - Custom FrameDecoder in netty -
i have problem framedecoder of netty following.
- packet fragmented in {n} frames framedecoder processing correctly.
- if many packets composed 1 frame , send server(when client sending small packet data continuously), framedecoder reads first packet. remaing ignored.
can remaining data continued executed framedecoder?
public class binaryframedecoder extends framedecoder { @override protected object decode(channelhandlercontext ctx, channel channel, channelbuffer buffer){ if(buffer.readablebytes() < 2){ return null; } int length = buffer.getshort(buffer.readerindex()); if(buffer.readablebytes() < length + 2){ return null; } buffer.skipbytes(2); return buffer; } }
it should work if replace:
return buffer;
with:
return buffer.readbytes(length);
because buffer
contains more 1 message.
Comments
Post a Comment