This function returns the results of an overlapped operation on the specified socket.
BOOL WSPGetOverlappedResult( SOCKET s, LPWSAOVERLAPPED lpOverlapped, LPDWORD lpcbTransfer, BOOL fWait, LPDWORD lpdwFlags, LPINT lpErrno );
[in] Points to a WSAOVERLAPPED structure that was specified when the overlapped operation was started.
[out] Points to a 32-bit variable that receives the number of bytes that were actually transferred by a send or receive operation, or by WSPIoctl.
[in] Specifies whether the function should wait for the pending overlapped operation to complete. If TRUE, the function does not return until the operation has been completed. If FALSE and the operation is still pending, the function returns FALSE and lpErrno is WSA_IO_INCOMPLETE. The fWait parameter may be set to TRUE only if the overlapped operation selected event-based completion notification.
[out] Points to a 32-bit variable that will receive one or more flags that supplement the completion status. If the overlapped operation was initiated through WSPRecv or WSPRecvFrom, this parameter will contain the results value for lpFlags parameter.
[out] Pointer to the error code.
The results reported by this function are those of the specified socket's last overlapped operation to which the specified WSAOVERLAPPED structure was provided, and for which the operation's results were pending. A pending operation is indicated when the function that started the operation returns SOCKET_ERROR, and the lpErrno is WSA_IO_PENDING. When an I/O operation is pending, the function that started the operation resets the hEvent member of the WSAOVERLAPPED structure to the nonsignaled state. Then, when the pending operation has been completed, the system sets the event object to the signaled state.
If the fWait parameter is TRUE, this function determines whether the pending operation has been completed by blocking and waiting for the event object to be in the signaled state. A client may set the fWait parameter to TRUE only if it selected event-based completion notification when the I/O operation was requested. If another form of notification was selected, the usage of the hEvent member of the WSAOVERLAPPED structure is different, and setting fWait to TRUE causes unpredictable results.