zoukankan      html  css  js  c++  java
  • Netty Server 启动时序图

    正常启动netty Server端代码如下

     1 // 配置服务端的NIO线程组
     2     EventLoopGroup bossGroup = new NioEventLoopGroup();
     3     EventLoopGroup workerGroup = new NioEventLoopGroup();
     4     ServerBootstrap b = new ServerBootstrap();
     5     b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
     6         .option(ChannelOption.SO_BACKLOG, 100)
     7         .handler(new LoggingHandler(LogLevel.INFO))
     8         .childHandler(new ChannelInitializer<SocketChannel>() {
     9             @Override
    10             public void initChannel(SocketChannel ch)
    11                 throws IOException {
    12             ch.pipeline().addLast(
    13                 new NettyMessageDecoder(1024 * 1024, 4, 4));
    14             ch.pipeline().addLast(new NettyMessageEncoder());
    15             ch.pipeline().addLast("readTimeoutHandler",
    16                 new ReadTimeoutHandler(50));
    17             ch.pipeline().addLast(new LoginAuthRespHandler());
    18             ch.pipeline().addLast("HeartBeatHandler",
    19                 new HeartBeatRespHandler());
    20             }
    21         });
    22 
    23     // 绑定端口,同步等待成功
    24     b.bind(NettyConstant.REMOTEIP, NettyConstant.PORT).sync();

    时序图如下

  • 相关阅读:
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
  • 原文地址:https://www.cnblogs.com/toUpdating/p/10072772.html
Copyright © 2011-2022 走看看