Multiplexing Multiple Clients When we have a "real" server, we need to be able to support multiple clients connecting to the server at the same time. This can be done using the 'select' system call, and the 'fd_set' structure. We first store a set of file descriptors with which we want to work, in an 'fd_set' structure. Here is how: #include /* fd_set and its macros. */ fd_set rfd; /* a file descriptors set. */ int s1, s2; /* socket file descriptors. */ /* clear up an 'fd_set' struct. */ FD_ZERO(&rfd); /* add both file descriptors to the set. */ FD_SET(s1, &rfd); FD_SET(s2, &rfd); /* check if descriptor 's1' is found in the set. */ if (FD_ISSET(s1, &rfd)) printf("s1 is found in the set\n"); else printf("s1 is not found in the set\n"); /* remove file descriptor 's1' from the set. */ FD_CLR(s1, &rfd);