Introductory concepts select() IO Pass a set of FDs to check for read, write and exceptional (OOB) data Obtain the set of FDs which are ready for IO fd_set rfds, wfds, efds; int readyfds; struct timeval timeout; FD_ZERO(&fdset); FD_SET(0, &rfds); FD_SET(1, &wfds); FD_SET(2, &wfds); readyfds = select(3, &rfds, &wfds, &efds, &timeout); if (FD_ISSET(0, &rfds)) { /* Handle STDIN ready */ } if (FD_ISSET(1, &wfds)) { /* Handle STDOUT ready */ } if (FD_ISSET(2, &wfds)) { /* Handle STDERR ready */ }