程序运行到这会卡住,等待有client来链接
void TCPServer::accepted()
{
socklen_t sosize = sizeof(clientAddress);
descript_socket *so = new descript_socket;
//程序运行到这会卡住,等待有client来链接
so->socket = accept(sockfd,(struct sockaddr*)&clientAddress,&sosize);
so->id = num_client;
so->ip = inet_ntoa(clientAddress.sin_addr);
newsockfd.push_back( so );
cerr << "accept client[ id:" << newsockfd[num_client]->id <<
" ip:" << newsockfd[num_client]->ip <<
" handle:" << newsockfd[num_client]->socket << " ]" << endl;
pthread_create(&serverThread[num_client], NULL, &Task, (void *)newsockfd[num_client]);
isonline=true;
num_client++;
}