netty
求知耶
Java工作者,一起学习,一起努力
展开
-
netty中粘包和半包的处理
处理粘包和半包 1. 概念 (1)半包:发送的数据包不完整,需要一次或几次接收才能组成完成的一个数据包; (2)粘包:就是发送了好几个数据包,其中一个数据包不完整。 2.代码 /** *处理粘包和半包 */ public class TestByteBufferExam { public static void main(String[] args) { ByteBuffer source = ByteBuffer.allocate(32); source.put(原创 2021-09-07 22:54:02 · 171 阅读 · 0 评论 -
netty中文件的遍历、删除、复制和传输
netty中文件的使用 1. 遍历文件夹和文件 /** * 遍历文件夹和文件 * * @throws IOException */ private static void m1() throws IOException { // 计数器 AtomicInteger dirCount = new AtomicInteger(); AtomicInteger fileCount = new AtomicInteg原创 2021-09-07 21:46:56 · 239 阅读 · 0 评论