WSAGetFailConnectOnIcmpError function (ws2tcpip.h)

Queries the state of the TCP_FAIL_CONNECT_ON_ICMP_ERROR socket option.


INT WSAGetFailConnectOnIcmpError(
  SOCKET Socket,
  DWORD  *Enabled



A descriptor that identifies a TCP socket.


Type: DWORD*

A pointer to a DWORD. On success, the function sets the DWORD to a non-zero value if TCP_FAIL_CONNECT_ON_ICMP_ERROR is enabled, otherwise zero.

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.


This functionality is supported through the TCP_FAIL_CONNECT_ON_ICMP_ERROR socket option. WSAGetFailConnectOnIcmpError is a type-safe wrapper for getting this socket option, and we recommend it over getsockopt.


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