python - IO completion port key confusion -


I'm writing an IO completion port based server (), using the CTPS module in the Python for the Windows DLL API I am using. But this is quite a straightforward use of APIs and this question is directed to those who have IOCP knowledge, not Python.

As I understand the document for CreateIoCompletionPort, you have your "user defined" full key when you call this function to handle the file (in my case in a socket), with the built IOC adding up. When you go around to call GetQueuedCompletionStatus, you get full key value with an indicator on the overlap object. The key to complete must be identified with the overlapping object and request completion.

However, suppose I pass 100 to my CreateIoCompletionPort call as a full key with an overlap object. When IO is completed in the same overlap object and it comes back via GetQueuedCompletionStatus, the complete key that comes with it is very large and does not conform to the original value of 100.

Am I mistaken that how the whole key works, or am I doing it wrong in the source code written above?

What do I have in my daily practice is that it is only OVERLAPPED Focusing on the result is best because it will be unchanged. One way that you can use it effectively is something like the following:

  struct full handler {OVERLAPPED dummy_ovl; / * Content which actually means something here for you;  

When you post something for IOCP (whether via I / O call or a post through Win32 API), you first enter the FullHandler object Use to track calls that you will make, and enter that object's address on OVERLAPPED * .

  CompletionHander my_handler; // my_handler Fill whatever is necessary // Do not forget to keep the original my_handler! // I / O call goes here, and for Overlip *: (Overlaped *) and My_Handler  

In this way, when you get the overlapped result You have to do this, it is put back on the closing handler and the voice! You have a basic reference to your call.

  overlappied * to_qud_complation_states; // Really get a price from_kundited_complete_status ending handler * handler_for_this_completion = (ending handler *) from_queued_completion_status; // Have fun!  

For more details on real-world settings, see the implementation of Boost Boost of ASIO for Windows. Here are some details such as OVERLAPPED you GetQueuedCompletionStatus To get the link, but again, see the link for a good way to apply.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -