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 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
结构的指针