一个简单的高并发的回应服务器,主要是使用boost的库! 自己测试过可以达到5万个并发!
程序的下载地址:http://download.csdn.net/detail/guanyijun123/8335907
#include <stdio.h>
//#include "AuthenHandle.h"
//#include "configure.h"
//#include "NetSocketCommand.h"
#ifdef WIN32 //for windows nt/2000/xp
//#include "gelsserver.h"
#pragma comment(lib,"Ws2_32.lib")
#else //for unix
#include <sys/socket.h>
// #include <sys/types.h>
// #include <sys/signal.h>
// #include <sys/time.h>
#include <netinet/in.h> //socket
// #include <netdb.h>
#include <unistd.h> //gethostname
// #include <fcntl.h>
#include <arpa/inet.h>
#include <string.h> //memset
typedef int SOCKET;
typedef struct sockaddr_in SOCKADDR_IN;
typedef struct sockaddr SOCKADDR;
#ifdef M_I386
typedef int socklen_t;
#endif
#define BOOL int
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define TRUE 1
#define FALSE 0
#endif //end #ifdef WIN32
static int count111 = 0;
static time_t oldtime = 0, nowtime = 0;
#include <list>
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include <boos