CreateIoCompletionPort()
is used to associate a socket with a completion port. However, when this socket is closed, then I need to "un-associate" it from the completion port. How can I do that?
相关问题
- Sorting 3 numbers without branching [closed]
- Multiple sockets for clients to connect to
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
A handle that is associated with an I/O Completion Port is removed from the port when the handle is closed. In case of a network socket, the handle is closed by calling
closesocket()
.The documentation for CreateIoCompletionPort contains remarks on resource handling:
Microsoft obviously doesn’t want ordinary users to do it, but nonetheless, there is an officially documented way (and it only required a madton of digging to find it):
Calling
NtSetInformationFile
, passing the valueFileReplaceCompletionInformation
for theFileInformationClass
parameter, will get it done. (This value is defined inFILE_INFORMATION_CLASS
)A copy of the description for this parameter value (emphasis mine):