After you have a file descriptor set initialized with the FD_ZERO macro, the next thing you want to accomplish is to register some file descriptors in it. This can be done with the FD_SET macro. The following example shows how a socket number c can be registered in a set named read_socks:
int c; /* Client socket */
fd_set read_socks; /* Read set */
. . .
After calling FD_SET, a bit has registered interest in the corresponding file descriptor within the referenced set.
Post a Comment