WSAOVERLAPPED structure

The Windows Sockets WSAOVERLAPPED structure provides a communication medium from the initiation of an overlapped I/O operation to its subsequent completion. Windows Sockets defines the WSAOVERLAPPED structure as equivalent to the Win32 OVERLAPPED structure.

Syntax

typedef struct _WSAOVERLAPPED {
  DWORD    Internal;
  DWORD    InternalHigh;
  DWORD    Offset;
  DWORD    OffsetHigh;
  WSAEVENT hEvent;
} WSAOVERLAPPED, *LPWSAOVERLAPPED;

Members

  • Internal
    Reserved.

  • InternalHigh
    Reserved.

  • Offset
    Reserved.

  • OffsetHigh
    Reserved.

  • hEvent
    Handle to a WSAEVENT object that represents an event.

Remarks

The SAN service provider exclusively controls only the Offset and OffsetHigh members of the WSAOVERLAPPED structure even though the SAN service provider's WSPGetOverlappedResult function must retrieve three values (byte count, flags, and error) from the structure. A SAN service provider can retrieve these three values any way it chooses as long as it interacts properly with the behavior of the WPUCompleteOverlappedRequest function. The following sequence outlines a typical implementation of WSPGetOverlappedResult:

  1. At the start of an I/O operation, the SAN service provider sets the Internal member of the WSAOVERLAPPED structure to WSS_OPERATION_IN_PROGRESS.

  2. After the I/O operation is complete, the SAN service provider performs the following actions:

    • Sets OffsetHigh to the Windows Sockets error code resulting from the I/O operation.
    • Sets Offset to the flags resulting from the I/O operation.
    • Calls WPUCompleteOverlappedRequest and passes the number of bytes transferred.
  3. WPUCompleteOverlappedRequest eventually sets the InternalHigh member of the WSAOVERLAPPED structure to the number of bytes transferred and then sets Internal to a value other than WSS_OPERATION_IN_PROGRESS.

  4. After the switch calls the SAN service provider's WSPGetOverlappedResult function, the SAN service provider checks the value in Internal. If the value is WSS_OPERATION_IN_PROGRESS, the SAN service provider waits for the event object ( hEvent member) to be set to the signaled state or returns an error, based on the value that the switch passed to the fWait parameter of WSPGetOverlappedResult. If the value is not WSS_OPERATION_IN_PROGRESS, or after the operating system signals the event object, the SAN service provider returns the number of bytes transferred, the operation result error code, and the flags in the InternalHigh, OffsetHigh, and Offset members, respectively.

For more information about WPUCompleteOverlappedRequest, see the Microsoft Windows SDK documentation.

Requirements

Version

Requires Windows Sockets version 2.0.

Header

Winsock2.h (include Winsock2.h)

See also

WSPGetOverlappedResult

WSPIoctl

WSPRdmaRead

WSPRdmaWrite

WSPRecv

WSPSend

 

 

Send comments about this topic to Microsoft