Added gai_strerror

This commit is contained in:
Lectem 2016-01-13 17:20:46 -05:00
parent 6eb23d3fbd
commit e9a476cfe2
2 changed files with 19 additions and 0 deletions

View File

@ -72,6 +72,7 @@ extern "C" {
void freeaddrinfo(struct addrinfo *ai); void freeaddrinfo(struct addrinfo *ai);
const char *gai_strerror(int ecode);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -0,0 +1,18 @@
#include <netdb.h>
const char *gai_strerror(int ecode)
{
switch(ecode)
{
case EAI_FAMILY :
return "ai_family not supported";
case EAI_MEMORY :
return "Memory allocation failure";
case EAI_NONAME :
return "Name or service not known";
case EAI_SOCKTYPE :
return "ai_socktype not supported";
default:
return "Unknown error";
}
}