更改/更新 CompletionKey [英] Change/Update the CompletionKey

查看:34
本文介绍了更改/更新 CompletionKey的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

在调用该函数后是否可以以某种方式更改/更新 CompletionKey?此外,同时发生在 serverock 和 clientsock 上的操作(例如,接受和接收模式下的 AcceptEx)仅返回服务器的完成,我可以将其更改为客户端还是更好地更改为两者?

Is it possible to change/update the CompletionKey somehow after I called the function? Also, an operation happening on both serversock and clientsock (E.g. AcceptEx in a mode that both accepts and receives) returns completion only for the server, can I change that to the Client or even better to both?

推荐答案

在我之后是否可以以某种方式更改/更新 CompletionKey调用了函数?

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

这可以从 Windows 8.1

您需要使用 NtSetInformationFileFileReplaceCompletionInformation

更改或删除指定文件句柄的 I/O 完成端口.调用者提供一个指向FILE_COMPLETION_INFORMATION 指定端口的结构句柄和完成键.如果端口句柄为非 NULL,则此句柄指定一个新的 I/O 完成端口与文件关联处理.删除与文件关联的 I/O 完成端口句柄,将结构中的端口句柄设置为NULL.获取端口句柄,用户模式调用者可以调用 CreateIoCompletionPort功能.

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

note that for initial set I/O completion port for the specified file handle we use FileCompletionInformation

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

however even if this is possible i think in most case will be wrong and not need do this

这篇关于更改/更新 CompletionKey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆