1.简介(出自blog.csdn.net/trojanpizza/article/details/6656671)
2.select模型的缺陷
3.Windows IOCP模型的缺陷
4.EPOLL模型的优点
5.EPOLL模型的工作模式
6.EPOLL模型的使用方法
对epoll 的操作就这么简单,总共不过4个API:epoll_create, epoll_ctl,epoll_wait和close。以下是man中的一个例子。
struct epoll_event for(;;) { if(client < 0) } |
7.EPOLL模型的一个实例
#include <iostream> #include <sys/socket.h> #include <sys/epoll.h> #include <netinet/in.h> #include <arpa/inet.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #define MAXLINE 10 #define OPEN_MAX 100 #define LISTENQ 20 #define SERV_PORT 5555 #define INFTIM 1000 void setnonblocking(int sock) { } int main() { } |
8.EPOLL进阶思考
8.1. 问题来源
8.2. 具体做法
发送函数代码如下:
bool send_data(int connfd, char *pbuffer, unsigned int &len,int flag) {
}
|