title: How to use Overlapped I/O with sockets?
body: <p>I want to use Overlapped I/O in my server, but I am unable to find many tutorials on the subject (most of the tutorials are about Overlapped I/O with Completion Ports, and I want to use a callback function).</p>
  
  <p>My server will have a maximum of 400 clients connected at one time, and it only send and receive data at a long periods of time (each 30 seconds a few kilobytes worth of data is exchanged between the server and the clients).</p>
  
  <p>The main reason why I want to use Overlapped I/O is because <code>select()</code> can only handle a maximum of 64 sockets (and I have 400!).</p>
  
  <p>So I will tell you how I understand Overlapped I/O and correct me if I'm wrong:</p>
  
  <ul>
  <li>If I want to receive data from one of the clients, I use <code>WSARecv()</code> and supply the socket handle, and a buffer to be filled with the received data, <strong>and also I supply a callback function</strong>. When the data is received and filled in the buffer, the callback function will be called, and I can process the data.</li>
  <li>When I want to send data I use <code>WSASend()</code>, I also supply the socket handle and the callback function, and when the data is sent (not sure if when placed in the underlying sent buffer or actually placed on the wire), the callback will also be called telling me that data was sent, and I can send the next piece of data.</li>
  </ul>