![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
netty
文章平均质量分 68
JYY_JYY_
这个作者很懒,什么都没留下…
展开
-
Netty笔记1——网络模型
网络IO模型(BIO, NIO, 多路复用, AIO) Reactor模型 单Reactor单线程 单Reactor多线程 主从Reactor多线程 结论 1. 网络模型 见笔记:https://blog.csdn.net/qq_41157876/article/details/110505416 2. Reactor模型 Reactor模型,是指通过一个或多个输入同时传递给服务处理器的服务请求的事件驱动处理模式 Reactor模式也叫Dispatcher模式,即I/O多了复.原创 2021-04-09 00:34:13 · 108 阅读 · 0 评论 -
Netty复习提纲
1. 网络模型(理论) 链接: 1 2. JAVA NIO(先验) 链接: 1 3. Netty入门:聊天室 链接: 1 4. ByteBuffer 5. Channel和Unsafe 6.ChannelPipeline和ChannelHandler 7. NioEventLoopGroup和NioEventLoop 8. BootStrap 9. 编解码器 / TCP粘包和拆包 ...原创 2021-02-22 18:29:23 · 75 阅读 · 0 评论 -
Netty——ChannelPipeline
类图 1 类图 1.1 ChannelOutboundInvoker 可以触发ChannelOutboundHandler相关方法 public interface ChannelOutboundInvoker { ChannelFuture bind(SocketAddress var1); ChannelFuture connect(SocketAddress var1); ChannelFuture connect(SocketAddress var1..原创 2020-12-21 15:18:13 · 119 阅读 · 0 评论 -
Netty——聊天室/入站和出战
聊天室实现 实验过程 过程分析 入站和出战 1. 聊天室实现 服务端启动类:MyChatServer import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel..原创 2020-12-18 16:53:41 · 228 阅读 · 0 评论 -
Netty——ChannelHandler
1. 接口ChannelHandler 方法:其中 ctx 为 ChannelHandlerContext 类 void handlerAdded( ctx ) 当把 ChannelHandler 添加到 ChannelPipeline 中时被调用 void handlerRemoved( ctx ) 当从 ChannelPipeline 中移除 ChannelHandler 时被调用 void exceptionCaught(ctx , Throwable ...原创 2020-12-15 13:57:23 · 222 阅读 · 0 评论 -
Netty——ByteBuf
ByteBuf 类图 ByteBuf 与 ByteBuffer 属性 / 方法 ByteBuf相关辅助类 ByteBufHolder ByteBufAllocator CompositeByteBuf ByteBufUtil 1. ByteBuf 1.1 ByteBuf类图 1.2 ByteBuf 与 ByteBuffer的区别 ByteBuffer中只有一个index,ByteBuf中有readIndex和writeIndex 由于有两个index,By.原创 2020-12-17 14:56:18 · 106 阅读 · 0 评论 -
Netty笔记——粘包和拆包
粘包和拆包 发送原因 业界解决策略 Netty提供的策略 LineBasedFrameDecoder DelimiterBasedFrameDecoder FixLengthFrameDecoder 问题说明 假设客户端分别发送了两个数据包D1和D2给服务端,由于服务端一次读取到字节数是不确定的,故可能存在以下四种情况: 1. 服务端分两次读取到了两个独立的数据包,分别是D1和D2,没有粘包和拆包 2. 服务端一次接受到了两个数据包,D1.原创 2020-12-17 11:27:11 · 121 阅读 · 0 评论