title: Waiting for data via select not working
body: <p>I'm currently working on a project which involves multiple clients connected to a server and waiting for data. I'm using select and monitoring the connection for incoming data. However, the client just continues to print nothing, acting as if select has discovered incoming data. Perhaps I'm attacking this wrong?</p>
  
  <p>For the first piece of data the server does send, it is displayed correctly. However, the server then disconnects and the client continues to spew blank lines.</p>
  
  <pre><code>        FD_ZERO(&amp;readnet);
          FD_SET(sockfd, &amp;readnet);   
  while(1){
  
              rv = select(socketdescrip, &amp;readnet, NULL, NULL, &amp;timeout);
              if (rv == -1) {
                  perror("select"); // error occurred in select()
              } else if (rv == 0) {
                  printf("Connection timeout!  No data after 10 seconds.\n");
              } else {
                  // one or both of the descriptors have data
                  if (FD_ISSET(sockfd, &amp;readnet)) {
                      numbytes = recv(sockfd, buf, sizeof buf, 0);
                      printf("Data Received\n");
                      buf[numbytes] = '\0';
                      printf("client: received '%s'\n",buf);
                      sleep(10);
                  }
              }
          }
  </code></pre>