完成端口GetQueuedCompletionStatus返回值的问题

本文探讨了完成端口GetQueuedCompletionStatus返回值的问题,包括不同返回状态的处理方式,如错误码1236、1234、64等。遇到WSASEND/WSARECV成功但IO被重置,服务器主动关闭socket,以及其他IO失败的情况,需要区分IO类型来处理。特别地,当UDP接收请求失败,完成键有时为NULL,这与MSDN文档描述不符,可能引发程序崩溃,需要在重新投递接收请求时进行判断。
摘要由CSDN通过智能技术生成

 完成端口GetQueuedCompletionStatus返回值的问题

先看看GetQueuedCompletionStatus函数的完整声明:
BOOL GetQueuedCompletionStatus(
  HANDLE CompletionPort,      
  LPDWORD lpNumberOfBytes,   
  PULONG_PTR lpCompletionKey, 
  LPOVERLAPPED *lpOverlapped, 
  DWORD dwMilliseconds
);

再看看MSDN上对其返回值的说明:

If the function dequeues a completion packet for a successful I/O operation from the completion port, the return value is nonzero. The function stores information in the variables pointed to by the lpNumberOfBytesTransferred, lpCompletionKey, and lpOverlapped parameters.
如果函数从完成端口取出一个成功I/O操作的完成包,返回值为非0。函数在指向lpNumberOfBytesTransferred, lpCompletionKey, and lpOverlapped的参数中存储相关信息。


If *lpOverlapped is NULL and the function does not dequeue a completion packet from the completion port, the return value is zero. The function does not s

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值