Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are associating the same socket with multiple IOCompletionPorts. I'm sure thats not valid. In your IOPortConnect function (Where you do the write) you call CreateIOCompletionPort 4 times passing in one shot handles.</p> <p>My advice:</p> <ul> <li>Create a single IOCompletion Port (that, ultimately, you associate numerous sockets with).</li> <li>Create a pool of worker threads (by calling CreateThread) that each then block on the IOCompletionPort handle by calling GetQueuedCompletionStatus in a loop.</li> <li>Create one or more WSA_OVERLAPPED sockets, and associate each one with the IOCompletionPort.</li> <li>Use the WSA socket functions that take an OVERLAPPED* to trigger overlapped operations.</li> <li>Process the completion of the issued requests as the worker threads return from GetQueuedCompletionStatus with the OVERLAPPED* you passed in to start the operation.</li> </ul> <p>Note: WSASend returns both 0, and SOCKET_ERROR with WSAGetLastError() as WSA_IO_PENDING as codes to indicate that you will get an IO Completion Packet arriving at GetQueuedCompletionStatus. Any other error code means you should process the error immediately as an IO operation was not queued so there will be no further callbacks.</p> <p>Note2: The OVERLAPPED* passed to the WSASend (or whatever) function is the OVERLAPPED* returned from GetQueuedCompletionStatus. You can use this fact to pass more context information with the call:</p> <pre><code>struct MYOVERLAPPED { OVERLAPPED ovl; }; MYOVERLAPPED ctx; WSASend(...,&amp;ctx.ovl); ... OVERLAPPED* pov; if(GetQueuedCompletionStatus(...,&amp;pov,...)){ MYOVERLAPPED* pCtx = (MYOVERLAPPED*)pov; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload