use of org.jboss.netty.channel.FixedReceiveBufferSizePredictor in project feeyo-hlsserver by variflight.
the class UdpServer method startup.
public void startup(int port) {
ChannelFactory channelFactory = new NioDatagramChannelFactory(Executors.newCachedThreadPool());
bootstrap = new ConnectionlessBootstrap(channelFactory);
bootstrap.setOption("reuseAddress", false);
bootstrap.setOption("child.reuseAddress", false);
// 15M
bootstrap.setOption("readBufferSize", 1024 * 1024 * 15);
bootstrap.setOption("writeBufferSize", 1024 * 20);
bootstrap.setOption("receiveBufferSizePredictor", new FixedReceiveBufferSizePredictor(1024 * 3));
bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(1024 * 3));
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("handler", new UdpServerChannelHandler());
return pipeline;
}
});
datagramChannel = (DatagramChannel) bootstrap.bind(new InetSocketAddress(port));
}
Aggregations