TIP 3:一个已投递的I/O操作和一个出列的完成通知的关联

TIP 3: Associate a posted I/O operation with a dequeued completion packet.

GetQueuedCompletionStatus returns a completion key and an overlapped structure for the I/O when dequeuing a completion packet. You should use these two structures to return per handle and per I/O operation information, respectively. You can use your socket handle as the completion key when you register the socket with the IOCP to provide per handle information. To provide per I/O operation "extend" the overlapped structure to contain your application-specific I/O-state information. Also, make sure you provide a unique overlapped structure for each overlapped I/O. When an I/O completes, the same pointer to the overlapped I/O structure is returned.
当一个完成通知出列的时候, GetQueuedCompletionStatus 返回了针对这个 I/O 一个完成键和一个重叠结构,你可以使用两个结构来分别接收返回的单句柄数据和单 IO 操作数据。当你把某个套接字和 IOCP 关联,你可以用套接字句柄作为完成键去提供单句柄信息。使用一个扩展的重叠结构其中包含了指定的 I/O 应用状态信息。区提供单 IO 操作数据服务。确认你为每一个重叠 I/O 操作,提供了一个唯一的重叠结构,当一个 I/O 完成,返回同一个指向重叠 IO 结构的指针
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值