gai_strerrorA function (ws2tcpip.h)

The gai_strerror function assists in printing error messages based on the EAI_* errors returned by the getaddrinfo function. Note that the gai_strerror function is not thread safe, and therefore, use of traditional Windows Sockets functions such as the WSAGetLastError function is recommended.

Syntax

char * gai_strerrorA(
  [in] int ecode
);

Parameters

[in] ecode

Error code from the list of available getaddrinfo error codes. For a complete listing of error codes, see the getaddrinfo function.

Return value

Returns a pointer to a string containing the error message.

Remarks

If the ecode parameter is not an error code value that getaddrinfo returns, the gai_strerror function returns a pointer to a string that indicates an unknown error.

Note

The ws2tcpip.h header defines gai_strerror as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ws2tcpip.h

See also

WSAGetLastError

Winsock Functions

Winsock Reference

getaddrinfo