标签:msdn trail aes sdn ping sock tag long set
详情参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms741688(v=vs.85).aspx
The WSARecv function receives data from a connected socket or a bound connectionless socket.
The WSARecv function provides some additional features compared with the standard recv function in three important areas:
WSARecv 和标准的recv相比有以下扩展特性:
1.可以和重叠sockets结合来使用重叠接收操作
2.允许使用多个接收buffer来应对分散/聚合型IO
3.lpFlags参数可以用在输入和输出上,允许应用感知输出状态的MSG_PARTIAL 标志位
int WSARecv( _In_ SOCKET s, _Inout_ LPWSABUF lpBuffers, _In_ DWORD dwBufferCount, _Out_ LPDWORD lpNumberOfBytesRecvd, _Inout_ LPDWORD lpFlags, _In_ LPWSAOVERLAPPED lpOverlapped, _In_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine );
s: 套接字句柄
lpBuffers: 与Recv函数不同 这里需要一个由WSABUF结构构成的数组
dwBufferCount: 数组中WSABUF结构的数量
lpNumberOfBytesRecvd: 如果接收操作立即完成,这里会返回函数调用所接收到的字节数
lpFlags:A pointer to flags used to modify the behavior of the WSARecv function call. For more information, see the Remarks section.
lpOverlapped:WSAOVERLAPPED structure
lpCompletionRoutine: A pointer to the completion routine called when the receive operation has been completed (ignored for nonoverlapped sockets).
Error code | Meaning |
---|---|
The virtual circuit was terminated due to a time-out or other failure. |
|
For a stream socket, the virtual circuit was reset by the remote side. The application should close the socket as it is no longer usable. For a UDP datagram socket, this error would indicate that a previous send operation resulted in an ICMP "Port Unreachable" message. |
|
Socket s is message oriented and the virtual circuit was gracefully closed by the remote side. |
|
The lpBuffers parameter is not completely contained in a valid part of the user address space. |
|
A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function. |
|
The (blocking) call was canceled by the WSACancelBlockingCall function. |
|
The socket has not been bound (for example, with bind). |
|
The message was too large to fit into the specified buffer and (for unreliable protocols only) any trailing portion of the message that did not fit into the buffer has been discarded. |
|
The network subsystem has failed. |
|
For a connection-oriented socket, this error indicates that the connection has been broken due to keep-alive activity that detected a failure while the operation was in progress. For a datagram socket, this error indicates that the time to live has expired. |
|
The socket is not connected. |
|
The descriptor is not a socket. |
|
MSG_OOB was specified, but the socket is not stream-style such as type SOCK_STREAM, OOB data is not supported in the communication domain associated with this socket, or the socket is unidirectional and supports only send operations. |
|
The socket has been shut down; it is not possible to call WSARecv on a socket after shutdown has been invoked with how set to SD_RECEIVE or SD_BOTH. |
|
The connection has been dropped because of a network failure or because the peer system failed to respond. |
|
Windows NT: Overlapped sockets: there are too many outstanding overlapped I/O requests. Nonoverlapped sockets: The socket is marked as nonblocking and the receive operation cannot be completed immediately. |
|
A successful WSAStartup call must occur before using this function. |
|
An overlapped operation was successfully initiated and completion will be indicated at a later time. |
|
The overlapped operation has been canceled due to the closure of the socket. |
标签:msdn trail aes sdn ping sock tag long set
原文地址:http://www.cnblogs.com/jasonsword/p/7531866.html