The parameters that we set using ServerBootStrap.option apply to the ChannelConfig of a newly created ServerChannel, i.e., the server socket which listens for and accepts the client connections. These options will be set on the Server Channel when bi…
一.首先来看一段服务端的示例代码: public class NettyTestServer { public void bind(int port) throws Exception{ EventLoopGroup bossgroup = new NioEventLoopGroup();//创建BOSS线程组 EventLoopGroup workgroup = new NioEventLoopGroup();//创建WORK线程组 try{ ServerBootstrap b = new S…
引言 前面我们介绍了网络一些基本的概念,虽然说这些很难吧,但是至少要做到理解吧.有了之前的基础,我们来正式揭开Netty这神秘的面纱就会简单很多. 服务端 public class PrintServer { public void bind(int port) throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(); //1 EventLoopGroup workerGroup = new NioEventLo…