//epoll通过将服务socket if (epoll_ctl(kdpfd, EPOLL_CTL_ADD, listener, &ev) < 0) 添加到epoll中
//然后listener监听链接请求,每次监听到一个新的链接就添加到epoll中 epoll_ctl
//如果不是新的链接那么直接创建一个子线程进行业务的处理
#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>
#include <pthread.h>
#define MAXBUF 1024
#define MAXEPOLLSIZE 10000
void pthread_handle_message(void para);
/
setnonblocking - 设置句柄为非阻塞方式
/
int setnonblocking(int sockfd)
{
if (fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFD, 0)|O_NONBLOCK) == -1) {
return -1;
}
return 0;
}
static int count111 = 0;
static time_t oldtime = 0, nowtime = 0;
//------------------------------