WSASend() 和 WSARecv() 的所有错误代码是否都意味着套接字已断开连接?
Does all error codes of WSASend() and WSARecv() means that the socket has disconnected?
我想知道使用IOCP时出现WSASend()
和WSARecv()
(WSA_IO_PENDING
除外)的错误码是否意味着socket已经断开。大多数错误代码都很明显,但我不确定以下内容:
WSASend()
的错误代码:
WSAEINPROGRESS
WSAENOBUFS
WSA_OPERATION_ABORTED
WSARecv()
的错误代码:
WSAEFAULT
WSAEINPROGRESS
答案
不,并非所有错误代码都是因为套接字断开连接。
详细说明
我实际上不确定如何在不大喊大叫的情况下回答这个问题“不,阅读文档!”。
例如,WSAEINPROGRESS
表示正在进行另一个阻塞操作 - 因此当前的操作已因此中止。
WSAEINPROGRESS
- 10036
Operation now in progress.
A blocking operation is currently executing. Windows Sockets only allows a single blocking operation—per- task or thread—to be outstanding, and if any other function call is made (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error.
我想知道使用IOCP时出现WSASend()
和WSARecv()
(WSA_IO_PENDING
除外)的错误码是否意味着socket已经断开。大多数错误代码都很明显,但我不确定以下内容:
WSASend()
的错误代码:
WSAEINPROGRESS
WSAENOBUFS
WSA_OPERATION_ABORTED
WSARecv()
的错误代码:
WSAEFAULT
WSAEINPROGRESS
答案
不,并非所有错误代码都是因为套接字断开连接。
详细说明
我实际上不确定如何在不大喊大叫的情况下回答这个问题“不,阅读文档!”。
例如,WSAEINPROGRESS
表示正在进行另一个阻塞操作 - 因此当前的操作已因此中止。
WSAEINPROGRESS
- 10036Operation now in progress.
A blocking operation is currently executing. Windows Sockets only allows a single blocking operation—per- task or thread—to be outstanding, and if any other function call is made (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error.