第四章:从零编写一个“玩具”项目

 

 

架构图

Netty源码剖析与实战-第七周

 

模块交互数据结构

Netty源码剖析与实战-第七周

 

 

Netty 编程中易错点解析
• LengthFieldBasedFrameDecoder 中initialBytesToStrip 未考虑设置
• ChannelHandler 顺序不正确
• ChannelHandler 该共享不共享,不该共享却共享
• 分配ByteBuf :分配器直接用ByteBufAllocator.DEFAULT 等,而不是采用ChannelHandlerContext.alloc()
• 未考虑ByteBuf 的释放
• 错以为ChannelHandlerContext.write(msg) 就写出数据了
• 乱用ChannelHandlerContext.channel().writeAndFlush(msg)
 

 

项目Demo地址

https://gitee.com/shao_yi_feng/netty.git

相关文章:

  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2021-10-05
  • 2021-05-19
  • 2021-11-06
猜你喜欢
  • 2021-12-06
  • 2021-12-22
  • 2021-08-03
  • 2021-05-01
  • 2021-11-28
  • 2021-06-06
  • 2021-09-24
相关资源
相似解决方案