Problem in LengthFieldBasedFrameDecoder

Johnny Luong johnny.luong at trustcommerce.com
Mon Apr 5 21:11:25 EDT 2010


You probably should read the documentation for the class and/or follow 
the examples but here goes:

The length field is composed of two bytes and how those two bytes are 
encoded affect how long of a string the decoder is expected.  So if you 
want a length of 12, you need to be encoding it as described in the docs 
from your client.

-Johnny

Balaaji Dayalarajan wrote:
> Hi,
>     I am running a server written in netty API with the following
> configuration 
> 
> new LengthFieldBasedFrameDecoder(14,0,2,0,2)
> 
> and send the following message "12HELLO, WORLD" continiously in a loop to
> the server.
> 
> I expect the server to decode the message and output this value "HELLO,
> WORLD" instead
> the handler complains
> org.jboss.netty.handler.codec.frame.TooLongFrameException: Adjusted frame
> length exceeds 14: 12596
> 
> the documentation for LengthFieldBasedFrameDecoder does'nt speak up about
> "maxFrameLength" value. why is the code complaining about the specific value
> "12596"?
> 
> if any body has used LengthFieldBasedFrameDecoder.Kindly pass on the
> configuration and sample message used.
> 
> any suggestions/views/comments to fix this is greatly appreciated.
> 
> Thanks in advance
> Balaaji.D
> 



More information about the netty-users mailing list