LengthFieldBasedFrameDecoder's maxFrameLength?

Christian Migowski chrismfwrd at gmail.com
Thu Aug 20 03:05:50 EDT 2009


Hi,

On Thu, Aug 20, 2009 at 8:51 AM, hezjing<hezjing at gmail.com> wrote:
> Hi
> May I know what is the maxFrameLength described in the constructor
> of LengthFieldBasedFrameDecoder?
> Assuming I have a fixed length header of 10 bytes and 2 bytes length field
> at offset 5,
> then the maxFrameLength is 10 (the size of the header)?

No. It is the length of the whole frame, including the payload, i.e.
the value of your length field in the header (+ header length,
depends). I haven't looked at the code, but I guess this if for
performance reasons: Netty needs to allocate buffers for storage of
the data until the amount of bytes it expects is received, and with
this you tell Netty the max size of that buffer.

regards,
christian

p.s. I find the description in the Javadoc clear enough


> The examples described in the LengthFieldBasedFrameDecoder apidoc is very
> helpful,
> probably we can also describe the maxFrameLength for every example in
> addition to lengthFieldOffset, lengthFieldLength, lengthAdjustment
> and initialBytesToStrip
> :-)
>
> --
>
> Hez
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
>



More information about the netty-users mailing list