title: Efficiency between select() and recv with MSG_PEEK. Asynchronous
body: <p>I would like to know what would be most efficient when checking for incoming data (asynchronously). Let's say I have 500 connections. I have 3 scenarios (that I can think of):</p>
  
  <ol>
  <li>Using select() to check FD_SETSIZE sockets at a time, then iterating over all of them to receive the data. (Wouldn't this require two calls to recv for each socket returned? MSG_PEEK to allocate a buffer then recv() it again which would be the same as #3)</li>
  <li>Using select() to check one socket at a time. (Wouldn't this also be like #3? It requires the two calls to recv.)</li>
  <li>Use recv() with MSG_PEEK one socket at a time, allocate a buffer then call recv() again. Wouldn't this be better because we can skip all the calls to select()? Or is the overhead of one recv() call too much?</li>
  </ol>
  
  <p>I've already coded the situations to 1 and 2, but I'm not sure which one to use. Sorry if I'm a bit unclear.</p>
  
  <p>Thanks</p>