changed nfds to FD_SETSIZE
added loop index to see if select ever returns. Like in return of the Jedi