UDP transfers only 768 bytes (build #59)

이희승 (Trustin Lee) trustin at gmail.com
Fri Sep 4 00:31:42 EDT 2009


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

-- 
Trustin Lee, http://gleamynode.net/


More information about the netty-dev mailing list