[关闭]
@Tyhj 2017-02-24T12:48:03.000000Z 字数 336 阅读 1908

Mina框架消息长度限制问题

Java


在使用mina框架时候,传输的数据太多的话会出错,因为数据长度有限制。
解决方法:

  1. TextLineCodecFactory textLineCodecFactory=new TextLineCodecFactory();
  2. //在这里设置限制长度
  3. textLineCodecFactory.setDecoderMaxLineLength(102400);
  4. textLineCodecFactory.setEncoderMaxLineLength(102400);
  5. //设定这个过滤器将一行一行(/r/n)的读取数据
  6. chain.addLast("myChin", new ProtocolCodecFilter(textLineCodecFactory));
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注