Fix bug in E2E call to select() (#18)

Two problems fixed:
    1. The return value of select() was never checked. Now we have an
       assertion to check for error.
    2. The 'nfds' argument passed to select() could be too large on
       some platforms. Now we set it to FD_SETSIZE---the largest valid
       value---on all platforms.

Problem 2 was triggered on my Macbook Pro running OS X 10.8.5 because
the value of getdtablesize() (10,000) was larger than the value of
FD_SETSIZE (1024).