epoll并发连接测试.docxVIP

  • 1
  • 0
  • 约5.53千字
  • 约 6页
  • 2019-09-14 发布于广东
  • 举报
亲测cpoll最大并发数,通过测试并发书为30000时,服务端会容易死机。 下而是服务端的程序: #include stdio.h #inelude stdlib.h #include errno?h #inelude string.h ftinclude sys/types. h #include netinet/in. h #inelude sys/socket.h #include sys/wai t. h #inelude unistd.h〉 ftinclude arpa/inet. h ^include fcntl. h #inelude sys/epoll.h #include sys/time.h #inelude sys/rcsourcc.h ^define MAXBUF 1024 #define MAXEPOLLSIZE 3000 /* sctnonblocking -设置句柄为非阻塞方式*/ int setnonblocking(int sockfd) { if (fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFD, 0) | 0_N0NBL0CK) ==-1) return -1; return 0; } int main( int argc, char* argv[]) { int 1 istener, new_fd,

文档评论(0)

1亿VIP精品文档

相关文档