我已在“receiveBufferSize”选项设置为1024,但由于某种原因,我仍然得到中的messageReceived只有768字节。 的数据的报头指示正在发送的数据的大小是1004。
下面是服务器的初始化代码:
public static void main(String[] args) throws Exception {
ConnectionlessBootstrap b = new ConnectionlessBootstrap(new NioDatagramChannelFactory());
// Options for a new channel
b.setOption("receiveBufferSize", 1024);
System.out.println(b.getOptions());
b.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
return Channels.pipeline(
new MyUDPPacketDecoder(),
new StdOutPrintHandler());
}
});
b.bind(new InetSocketAddress(myPort));
}