![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
网络编程
文章平均质量分 55
小朱今天努力了吗
这个作者很懒,什么都没留下…
展开
-
基于有限状态机实现http解析
有限状态机:像类似http协议的应用层协议头部包含很多数据类型的字段, 每种类型字段可以映射为逻辑单元的一种执行状态,根据这些状态编写相应的处理逻辑. 自己的表述:解析http这种协议,他在解析的过程中存在不同的状态, 我们在解析的时候根据解析的内存判断不同状态下不同的处理方法,通过状态的转换,实现对协议的解析. 基本框架就是 switch (type) { case TYPEA: process_type_a(); type = TYPEC; break; case T原创 2022-03-27 20:38:59 · 982 阅读 · 0 评论 -
多进程socket通信
服务端 #include<stdio.h> #include <string.h> #include <unistd.h> //系统调用的接口 #include <netdb.h> //网络有关 #include <sys/types.h> //linux相关基本数据类型 #include <sys/socket.h> #include <arpa/inet.h> class CTcpServer{ public.原创 2022-03-26 08:50:38 · 1236 阅读 · 2 评论