-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Description
void TCPServer::accepted()
{
socklen_t sosize = sizeof(clientAddress);
descript_socket so = new descript_socket;
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]);
pthread_create(&serverThread[num_client], NULL, Task, (void *)newsockfd[num_client]);
isonline=true;
num_client++;
}
why use "&Task" ? I think should use “Task” !! both ways of writing code can work, I can't understand the reason of them.
Metadata
Metadata
Assignees
Labels
No labels