WSASetRecvIPEcn function (ws2tcpip.h)

Specifies whether the IP stack should populate the control buffer with a message containing the explicit congestion notification (ECN) codepoint of the Type of Service IPv4 header field (or Traffic Class IPv6 header field) on a received datagram.

When you enable the receipt of ECN codepoints, the LPFN_WSARECVMSG (WSARecvMsg) function returns optional control data containing the ECN codepoint of the received datagram. The returned control message type will be IP_ECN (or IPV6_ECN) with level IPPROTO_IP (or IPPROTO_IPV6). The control message data is returned as an INT. This option is valid only on datagram sockets (the socket type must be SOCK_DGRAM).

For more info, and code examples, see Winsock explicit congestion notification (ECN). Also see WSAGetRecvIPEcn.

Syntax

INT WSASetRecvIPEcn(
  SOCKET Socket,
  DWORD  Enabled
);

Parameters

Socket

Type: _In_ SOCKET

A descriptor that identifies the socket.

Enabled

Type: _In_ DWORD

TRUE to enable the receipt of ECN codepoints; FALSE to disable.

Return value

If the function succeeds, then the return value is 0. Otherwise, a value of SOCKET_ERROR is returned, and you can retreive a specific error code by calling WSAGetLastError.

Requirements

Requirement Value
Minimum supported client Windows 10 Build 20348
Minimum supported server Windows 10 Build 20348
Header ws2tcpip.h

See also