Provides a descriptive text string that corresponds to an EAI_xxx error value. Format #include <netdb.h> const char *gai_strerror ( int ecode );
1 – Arguments
ecode The ecode argument is one of the EAI_xxx values defined for the getaddrinfo() and getnameinfo() functions. The values for ecode are: EAI_AGAIN The name could not be resolved at this time. Future attempts may succeed. EAI_BADFLAGS The flags parameter had an invalid value. EAI_FAIL A nonrecoverable error occurred when attempting to resolve the name. EAI_FAMILY The address family was not recognized. EAI_MEMORY There was a memory allocation failure when trying to allocate storage for the return value. EAI_NONAME The name does not resolve for the supplied parameters. Neither nodename nor servname were supplied. At least one of these must be supplied. EAI_SERVICE The service passed was not recognized for the specified socket type. EAI_SOCKTYPE The intended socket type was not recognized. EAI_SYSTEM A system error occurred; the error code can be found in errno.
2 – Description
This function returns a descriptive text string that corresponds to an EAI_xxx error value. The return value points to a string that describes the error. If the argument is not one of the EAI_ xxx values, the function returns a pointer to a string whose contents indicate an unknown error. For a complete list of error codes, see Error Codes.
3 – Return Values
x text string -1 Failure