title: Added the same socket fd twice to fd_set then calling select
body: <p>I'm been reading the man page for select (from difference sources) and can't seem to get a straight explanation.</p>
  
  <p>Lets say I have an already connected socket like this:</p>
  
  <pre><code>s1 = socket(...);
  connect(s1, ...)...
  </code></pre>
  
  <p>Now lets say I add the socket twice (eg: mistakenly) to the same fd_set like so:</p>
  
  <pre><code>fd_set readfds;
  
  
  FD_ZERO(&amp;readfds);
  FD_SET(s1, &amp;readfds);
  ....
  FD_SET(s1, &amp;readfds);
  </code></pre>
  
  <p>Now I call select:</p>
  
  <pre><code>int rv = select(n, &amp;readfds, NULL, NULL, &amp;tv);
  
  if (rv == -1) {
     perror("select"); // error occurred in select()
  }
  else if (rv == 0) {
     printf("Timeout occurred!  No data after 10.5 seconds.\n");
  }
  else {
     // one the descriptors have data
     .....
  }
  </code></pre>
  
  <p>If data is send from the socket, will select have set both FDs as ready or only the first one that I've added?</p>