![](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/1105054162. Reactor模型Reactor模型,是指通过一个或多个输入同时传递给服务处理器的服务请求的事件驱动处理模式 Reactor模式也叫Dispatcher模式,即I/O多了复.原创 2021-04-09 00:34:13 · 108 阅读 · 0 评论 -
Netty复习提纲
1. 网络模型(理论)链接:12. JAVA NIO(先验)链接:13. Netty入门:聊天室链接:14. ByteBuffer5. Channel和Unsafe6.ChannelPipeline和ChannelHandler7. NioEventLoopGroup和NioEventLoop8. BootStrap9. 编解码器 / TCP粘包和拆包...原创 2021-02-22 18:29:23 · 76 阅读 · 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 · 125 阅读 · 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 · 229 阅读 · 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 · 228 阅读 · 0 评论 -
Netty——ByteBuf
ByteBuf 类图 ByteBuf 与 ByteBuffer 属性 / 方法 ByteBuf相关辅助类 ByteBufHolder ByteBufAllocator CompositeByteBuf ByteBufUtil 1. ByteBuf1.1 ByteBuf类图1.2 ByteBuf 与 ByteBuffer的区别ByteBuffer中只有一个index,ByteBuf中有readIndex和writeIndex 由于有两个index,By.原创 2020-12-17 14:56:18 · 107 阅读 · 0 评论 -
Netty笔记——粘包和拆包
粘包和拆包 发送原因 业界解决策略 Netty提供的策略 LineBasedFrameDecoder DelimiterBasedFrameDecoder FixLengthFrameDecoder 问题说明 假设客户端分别发送了两个数据包D1和D2给服务端,由于服务端一次读取到字节数是不确定的,故可能存在以下四种情况: 1. 服务端分两次读取到了两个独立的数据包,分别是D1和D2,没有粘包和拆包 2. 服务端一次接受到了两个数据包,D1.原创 2020-12-17 11:27:11 · 123 阅读 · 0 评论