Iterate through all active file descriptors. If a client socket is ready to read, call recv() .
: Verify the port argument, configure the server socket, and bind it to localhost ( 127.0.0.1 ). 42 Exam 06
while (waitpid(-1, NULL, WNOHANG) > 0);
The exam’s checker spawns many processes. If you just use wait(NULL) , you might reap the wrong child. If you use a loop, you might block forever. Iterate through all active file descriptors