随笔分类 -  netty学习笔记

摘要:ByteBuf是netty传输数据的容器,是对jdk ByteBuffer的增强 1.ByteBuf的创建 //使用ByteBufAllocator创建空参创建默认的容量为256,也可以自己指定大小,创建时指定 默认是直接内存 ByteBuf buffer = ByteBufAllocator.DE 阅读全文
posted @ 2022-05-17 15:06 wangkunlaile 阅读(199) 评论(0) 推荐(0)
摘要:服务器端代码 //创建服务器 new ServerBootstrap()//指定eventLoop分组.group(new NioEventLoopGroup()) //指定channel实现 服务器选择NioServerSocketChannel.channel(NioServerSocketCh 阅读全文
posted @ 2022-05-16 16:48 wangkunlaile 阅读(98) 评论(0) 推荐(0)