LPWSAOVERLAPPED_COMPLETION_ROUTINE callback function (winsock2.h)

LPWSAOVERLAPPED_COMPLETION_ROUTINE is a function pointer type. You implement a matching callback function in your app, and pass that to functions such as WSAIoctl, WSARecv, and WSASend, among others.

The system calls your callback function when the asynchronous input and output (I/O) operation is completed or canceled, and the calling thread is in an alertable state (by using the SleepEx, MsgWaitForMultipleObjectsEx, WaitForSingleObjectEx, or WaitForMultipleObjectsEx function with the fAlertable parameter set to TRUE).

Syntax

LPWSAOVERLAPPED_COMPLETION_ROUTINE LpwsaoverlappedCompletionRoutine;

void LpwsaoverlappedCompletionRoutine(
  DWORD dwError,
  DWORD cbTransferred,
  LPWSAOVERLAPPED lpOverlapped,
  DWORD dwFlags
)
{...}

Parameters

dwError

Type: IN DWORD

The I/O completion status. This parameter can be one of the system error codes.

cbTransferred

Type: IN DWORD

The number of bytes transferred. If an error occurs, this parameter is zero.

lpOverlapped

Type: IN LPWSAOVERLAPPED

A pointer to the WSAOVERLAPPED structure specified by the asynchronous I/O function.

The system doesn't use the WSAOVERLAPPED structure after the completion routine is called, so the completion routine can deallocate the memory used by the overlapped structure.

dwFlags

Type: IN DWORD

Flags associated with the call.

Return value

None

Remarks

See LPOVERLAPPED_COMPLETION_ROUTINE.

Requirements

   
Header winsock2.h