#include<string.h> #include<signal.h> #include<stdio.h> #include<sys/socket.h> #include<stdlib.h> #include<netdb.h> #include<pthread.h> #include<memory.h> #include<semaphore.h> int Thread_num=0,count=0; //定义客户端计数器,写线程计数器 int sockfd; sem_t sem,sem2; pthread_mutex_t tmutex,cmutex; pthread_attr_t pattr; //定义要创建的线程属性 void ct_thread(char* arg,int acpfd); char chatct[1024]; //定义聊天缓存 void get_sys_time(char* tbuf) //函数功能:得到当前系统时间并进行裁剪 { long t=time(0); char *stime=ctime(&t); int i=11; tbuf[0]='('; for(;i<20;i++) tbuf[i-10]=stime[i]; tbuf[i-11]=')'; tbuf[i-10]='