NetworkServer.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:cr-private-server 作者:
public void start() {
    bossGroup = new NioEventLoopGroup();
    workerGroup = new NioEventLoopGroup();

    ServerBootstrap bootstrap = new ServerBootstrap();
    bootstrap
            .group(bossGroup, workerGroup)
            .channel(NioServerSocketChannel.class)
            .option(ChannelOption.SO_BACKLOG, 1024)
            .childOption(ChannelOption.SO_KEEPALIVE, true)
            .childHandler(new PlayerInitializer(this));

    try {
        channel = bootstrap.bind(server.getConfig().get("server.port").getAsShort()).sync().channel();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号