epoll同时处理海量连接的代码.docxVIP

  • 4
  • 0
  • 约4.96千字
  • 约 7页
  • 2017-12-17 发布于河南
  • 举报
epoll同时处理海量连接的代码

epoll同时处理海量连接的代码[ 2010/06/12 16:24 | by root ] #include stdio.h#include stdlib.h#include errno.h#include string.h#include sys/types.h#include netinet/in.h#include sys/socket.h#include sys/wait.h#include unistd.h#include arpa/inet.h//#include openssl/ssl.h//#include openssl/err.h#include fcntl.h#include sys/epoll.h#include sys/time.h#include sys/resource.h#define MAXBUF 1024#define MAXEPOLLSIZE 10000/*setnonblocking - 设置句柄为非阻塞方式*/intsetnonblocking(intsockfd){????if (fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFD, 0)|O_NONBLOCK) == -1) {????????return -1;????}????return 0;}/*handle_message - 处理每个

文档评论(0)

1亿VIP精品文档

相关文档