引用此评论
protected ServerBootstrap initServerBootstrap4Netty() { return new ServerBootstrap() // 设置并绑定Reactor线程池 .group(__bossGroup4Netty, __workerGroup4Netty) // 设置并绑定服务端Channel .channel(MBUDPServerChannel.class) // 初始化针对客户端的handler链 .childHandler(initChildChannelHandler4Netty()); }
protected ServerBootstrap initServerBootstrap4Netty() { //** 新建启动器 ServerBootstrap bootstrap = new ServerBootstrap() // 设置并绑定Reactor线程池 .group(__bossGroup4Netty, __workerGroup4Netty) // 设置并绑定服务端Channel .channel(NioServerSocketChannel.class) // 初始化针对客户端的handler链 .childHandler(initChildChannelHandler4Netty()); //** 设置TCP参数 // 设置待决accept连接的最大个数(资料:[url]https://blog.csdn.net/fd2025/article/details/79740226[/url]) bootstrap.option(ChannelOption.SO_BACKLOG, 4096); // 维持链接的活跃,清除死链接 bootstrap.childOption(ChannelOption.SO_KEEPALIVE, true); // 关闭延迟发送 bootstrap.childOption(ChannelOption.TCP_NODELAY, true); return bootstrap; }
Copyright © 2014-2024 即时通讯网 - 即时通讯开发者社区 / 版本 V4.4
苏州网际时代信息科技有限公司 (苏ICP备16005070号-1)
Processed in 0.109373 second(s), 24 queries , Gzip On.