getaddrinfo Input Host name (numeric IPv4/v6 addr string, FQDN string) Service name ("80" or "http") Type of service you wish to use Output All information needed for socket/bind/connect sockaddr, protocol number, socket type, etc int getaddrinfo(host, port, hints, res) const char *host; const char *port; const struct addrinfo *hints; struct addrinfo **res; struct addrinfo { int ai_flags; int ai_family; /* PF_xxx */ int ai_socktype; /* SOCK_xxx */ int ai_protocol; size_t ai_addrlen; char *ai_canonname; struct sockaddr *ai_addr; struct addrinfo *ai_next; };