ServerBootstrap的handler()和childHandler()区别

 

 

 

无论服务端还是客户端都进行了handler的设置,通过添加hanlder,我们可以监听Channel的各种动作以及状态的改变,包括连接,绑定,接收消息等。

区别:
  1. handler在初始化时就会执行
  2.childHandler会在客户端成功connect后才执行

 

posted @ 2021-09-14 13:43  Java技术债务  阅读(407)  评论(0编辑  收藏  举报