UDP transfers only 768 bytes (build #59)

Thomas Bocek bocek at ifi.uzh.ch
Fri Sep 4 03:29:18 EDT 2009


이희승 (Trustin Lee) wrote:
> On Thu, 3 Sep 2009 03:02:31 +0900 (KST)
> Thomas Bocek <bocek at ifi.uzh.ch> wrote:
>> Hi Trustin,
>>
>> I think the UDP channel only transfers 768 bytes. Please see the
>> attached testcase, which fails at transfering 800 bytes.
>>
>> Thomas
> 
> It is an expected default behavior.  You can increase the limit by
> configuring the ReceiveBufferSizePredictor of the DatagramChannelConfig:
> 
>   DatagramChannel ch = ...;
>   ch.getConfig().setReceiveBufferSizePredictor(
>           new FixedReceiveBufferSizePredictor(1024));
> 
> The default predictor is new FixedReceiveBufferSizePredictor(768), and
> that's why you see truncation.
> 
> Alternatively, you can specify the predictor as a bootstrap option:
> 
>   Bootstrap b = ...;
>   b.setOption("receiveBufferSizePredictor", 
>               new FixedReceiveBufferSizePredictor(1024));
> 
> HTH,
> Trustin
> 

Thanks, that solved it!

Thomas


More information about the netty-dev mailing list