// The following sample code is just one way to the the multiclient connection, // I am sure there is better ways ... // do not forget to handle the exceptions static void oneClientConnection(void *aSocket) { // do the communication using aSocket ... } // in your main function pthread_t tids[MAX_CONNECTIONS]; // all the necessary work to create, bind and listen ... client_socket = accept(listen_socket, , ); // you should keep track of the number of connections if (pthread_create(&(tids[i]), NULL, &oneClientConnection, (void *)&client_socket) !=0 ) { perror("pthread_create"); exit(-2); }