Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
getaddrinfo(3) OSS Library Calls Reference Manual
NAME
getaddrinfo - Converts hostnames and service names into socket address information structures
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
#include <netdb.h>
int getaddrinfo(
const char *hostname,
const char *service,
const struct addrinfo *hints,
struct addrinfo **result);
PARAMETERS
hostname Specifies one of the following:
• An Internet node hostname
• An IPv4 address in dotted-decimal format
• An IPv6 address in hexadecimal format
• NULL if no hostname requires converting; when NULL is used, either
service or hints must be nonNULL
service Specifies one of the following:
• A network service name
• A decimal port number
• NULL if no service name requires converting; when NULL is used,
either hostname or hints must be nonNULL
hints Specifies one of the following:
• A pointer to an addrinfo struct for a socket; the format of the addrinfo
structure is defined in the header file netdb.h
• NULL if no struct is available; when NULL is used, either hostname or
service must be nonNULL
result Upon successful completion, points to a list of addrinfo structs
DESCRIPTION
This function converts hostnames and service names into socket address information structures.
You allocate a hints structure, initialize it to 0 (zero), fill in needed fields, and then call this func-
tion.
This function returns a linked list of socket address information structures called addrinfo structs
that you can then use with other socket functions. The format of the addrinfo structure is:
struct addrinfo {
int ai_flags; /* See text below for details.*/
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
3−10 Hewlett-Packard Company 527187-017