以下是我写的socket服务器端的代码,使用select接受连接,
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <time.h>
#define D_LINE(_STR_) printf("f:%s(l:%d)-fn:%s():%s/n",__FILE__,__LINE__,__FUNCTION__,_STR_);
#define SERVER_PORT 1025
#define LENGTH_OF_LISTEN_QUEUE 100
#define BUFFER_SIZE 1024
#define MAX_RECV 10
#define SELECT_WAIT_SEC 0; // in second
#define SELECT_WAIT_USEC 3000; // in usecond
int main()
{
int i;
struct sockaddr_in server_addr;
/*================ for felect =======