linux基础编程 套接字socket 完整的服务器端多线程socket程序
2013年06月16日
⁄ 综合
⁄ 共 871字 ⁄ 字号
小 中 大
-
#include<stdlib.h>
-
#include<stdio.h>
-
#include<string.h>
-
#include<errno.h>
-
#include<netdb.h>
-
#include<sys/types.h>
-
#include<netinet/in.h>
-
#include<sys/socket.h>
-
#include<sys/wait.h>
-
#include<unistd.h>
-
#include<pthread.h>
-
#include<fcntl.h>
-
-
#define __DEBUG
-
#ifdef __DEBUG
-
#define DBG(fmt,args...) fprintf(stdout, fmt, ##args)
-
#else
-
#define DBG(fmt,args...)
-
#endif
-
#define ERR(fmt,args...) fprintf(stderr, fmt, ##args)
-
-
-
-
-
-
-
static int isStreamQuit = 0;
-
static int gStreamServerFd = -1;
-
int gStreamClientFd;
-
-
#define PORT_SOCKET 9000 //server监听端口
-
#define RECV_BUF_MAX_LEN 512
-
#define TIME_WAIT 200000 /*200ms*/
-
-
-
-
-
int ScketSend(unsigned char *buf,unsigned int len)
-
{
-
-