上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 29 下一页
摘要: ![image](https://img2022.cnblogs.com/blog/2411020/202203/2411020-20220307172852290-1981987439.png) 阅读全文
posted @ 2022-03-07 17:39 蘑菇王国大聪明 阅读(21) 评论(0) 推荐(0)
摘要: epoll介绍 本质是一个红黑树,epfd是红黑树的根,然后挂子节点 epoll所需函数 int eopll_create(int size) size:创建的红黑树的监听节点数量。(仅供内核参考) 返回值:指向新创建的新红黑数的根节点epfd,失败就-1 int eopll_ctl(int epf 阅读全文
posted @ 2022-03-06 13:04 蘑菇王国大聪明 阅读(151) 评论(0) 推荐(0)
摘要: ![image](https://img2022.cnblogs.com/blog/2411020/202203/2411020-20220306100847431-448980419.png) 阅读全文
posted @ 2022-03-06 10:09 蘑菇王国大聪明 阅读(24) 评论(0) 推荐(0)
摘要: poll函数原型 三个分别是:待监听的文件描述符、待监听的文件描述符对应的监听事件、传入时给0,如果满足对应事件的话返回非0, nfds:监听数组的实际有效的监听个数 超时时长:单位毫秒 代码 /**************************************************** 阅读全文
posted @ 2022-03-05 19:19 蘑菇王国大聪明 阅读(95) 评论(0) 推荐(0)
摘要: 多路IO转接服务器 select函数参数 select相关函数 select实现多路IO转接服务器 /************************************************************************* > File Name: server.c > A 阅读全文
posted @ 2022-03-04 19:58 蘑菇王国大聪明 阅读(109) 评论(0) 推荐(0)
摘要: 高并发服务器 多进程并发服务器 多线程并发服务器 多进程并发服务器实现 server.c #include <stdio.h> #include <string.h> #include <netinet/in.h> #include <arpa/inet.h> #include <signal.h> 阅读全文
posted @ 2022-03-04 16:19 蘑菇王国大聪明 阅读(63) 评论(0) 推荐(0)
摘要: wrap.c #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <errno.h> #include <sys/socket.h> void perr_exit(const char *s) { perror(s) 阅读全文
posted @ 2022-03-04 12:10 蘑菇王国大聪明 阅读(44) 评论(0) 推荐(0)
摘要: socket套接字 网络字节序 小端法存储,高位存高地址,地位存低地址。网络字节序是大端法: sockaddr地址结构 socket模型 客户端和服务端进行通信的时候会有3个socket socket()和bind()函数 listen()和accept()函数 accept()阻塞等待客户端进行连 阅读全文
posted @ 2022-03-03 20:24 蘑菇王国大聪明 阅读(50) 评论(0) 推荐(0)
摘要: 协议 分层模型 网络传输数据封装流程 以太网帧协议和ARP 目的地址和源地址是MAC地址 ARP数据格式如下: ip格式 BS和CS模型 阅读全文
posted @ 2022-03-03 17:04 蘑菇王国大聪明 阅读(13) 评论(0) 推荐(0)
摘要: 线程同步概念 互斥锁 读写锁 死锁 条件变量 本身不是锁,但通常结合锁来使用 生产者消费者模型 /************************************************************************* > File Name: producer_consu 阅读全文
posted @ 2022-03-02 19:58 蘑菇王国大聪明 阅读(23) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 29 下一页