1.1.24.16 getaddrinfo
C
int getaddrinfo(const char *host, const char *serv, const struct addrinfo *hint, struct addrinfo **res)
Description
Network address and service translation.
Parameters
Parameters | Description |
---|---|
host | Pointer to host to translate. |
serv | Pointer to service to translate, currently ignored. |
hint | Hint to affect the translation. |
res | Pointer to results pointer. |
Returns
EAI_NONAME - The node or service is not known.
EAI_AGAIN - The name server returned a temporary failure indication. Try again later.
EAI_SYSTEM - Other system error;
errno
is set to indicate the error.EAI_MEMORY - Out of memory.
EAI_SERVICE - The requested service is not available for the requested socket type.
Remarks
errno | Description |
---|---|
EFAULT | System fault. |
EBADMSG | Bad message. |
The getaddrinfo()
function allocates and initializes a linked list of addrinfo
structures, one for each network address that matches node and service, subject to any restrictions imposed by hints, and returns a pointer to the start of the list in res
. The items in the linked list are linked by the ai_next
field.
The freeaddrinfo()
function frees the memory that was allocated for the dynamically allocated linked list res
.