void* thread(void* arg)
{
std::cout << "Hi" << std::endl;
return arg;
}
void clientFunc(TCPSocket* s)
{
pthread_t pid;
pthread_create(&pid, NULL, &thread, NULL);
pthread_join(pid, NULL);
}
int main()
{
ServerSocket s(4543);
try {
while(1)
{
clientFunc(s.accept());
}
}catch(Error& err) {
err.what();
}
}
My question is, how can I create threads for every client that connects ,every thread to do something else?