WSAGetIcmpErrorInfo function (ws2tcpip.h)

Retrieves information about an ICMP error received on a TCP socket during connection setup.

Syntax

INT WSAGetIcmpErrorInfo(
  [in]  SOCKET          Socket,
  [out] ICMP_ERROR_INFO *Info
);

Parameters

[in] Socket

A descriptor that identifies a TCP socket.

[out] Info

Type: DWORD*

A pointer to an ICMP_ERROR_INFO structure. On success, the function initializes the structure.

Return value

On success, the function returns 0. Otherwise, a value of SOCKET_ERROR is returned, and you can retrieve a specific error code by calling WSAGetLastError.

Remarks

If no ICMP error has been received since the last connect call, then WSANO_DATA is returned. This functionality is supported through the TCP_ICMP_ERROR_INFO socket option. WSAGetIcmpErrorInfo is a type-safe wrapper for getting this socket option, and we recommend it over getsockopt.

Requirements

Requirement Value
Minimum supported client Windows 10, version 2004 (10.0; Build 19041)
Minimum supported server Windows Server, version 2004 (10.0; Build 19041)
Target Platform Windows
Header ws2tcpip.h
Library Ws2_32.lib
DLL Ws2_32.dll