@Override
protected void initChannel(SocketChannel ch) throws Exception {
try {
ch.config().setOption(ChannelOption.IP_TOS, 0x18);
// ch.config().setOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, 32 * 1024);
// ch.config().setOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, 8 * 1024);
} catch (ChannelException ex) {
// IP_TOS not supported by platform, ignore
}
ch.config().setAllocator(PooledByteBufAllocator.DEFAULT);
PacketRegistry r = new PacketRegistry();
ch.pipeline().addLast(new HttpServerCodec());
ch.pipeline().addLast(new HttpObjectAggregator(65536));
ch.pipeline().addLast(new WebSocketHandler());
ch.pipeline().addLast(new PacketDecoder(r));
ch.pipeline().addLast(new PacketEncoder(r));
ch.pipeline().addLast(new ClientHandler(server));
}
NetworkManager.java 文件源码
java
阅读 89
收藏 0
点赞 0
评论 0
项目:SurvivalMMO
作者:
评论列表
文章目录