Change/Update 完成键

Change/Update the CompletionKey

ULONG_PTR CKey = 2; CreateIoCompletionPort(...Ckey...);

是否可以在我调用该函数后以某种方式 change/update CompletionKey? 另外,serversock 和 clientsock 上都发生了一个操作(例如 AcceptEx 在接受和接收模式下)returns 仅针对服务器完成,我可以将其更改为客户端还是更好地更改为两者?

Is it possible to change/update the CompletionKey somehow after I called the function?

这可能从 Windows 8.1

开始

你需要使用 NtSetInformationFileFileReplaceCompletionInformation

Change or remove the I/O completion port for the specified file handle. The caller supplies a pointer to a FILE_COMPLETION_INFORMATION structure that specifies a port handle and a completion key. If the port handle is non-NULL, this handle specifies a new I/O completion port to associate with the file handle. To remove the I/O completion port associated with the file handle, set the port handle in the structure to NULL. To get a port handle, a user-mode caller can call the CreateIoCompletionPort function.

请注意,对于指定文件句柄的初始设置 I/O 完成端口,我们使用 FileCompletionInformation

然而,即使这是可能的,我认为在大多数情况下都是错误的,不需要这样做