From Fedora Project Wiki

< Networking

Revision as of 19:51, 21 November 2012 by Pavlix (talk | contribs) (Created page with "== Domain Name System === Resolving using <code>getaddrinfo()</code> in applications The <code>getaddrinfo()</code> function is a dualstack-friendly API to name resolution. ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

== Domain Name System

=== Resolving using getaddrinfo() in applications

The getaddrinfo() function is a dualstack-friendly API to name resolution. It is used by applications to translate host and service names to a linked list of struct addrinfo objects.

And example of getaddrinfo() call:

int error;
struct addrinfo hints;
struct addrinfo *result;

hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = 0;
hints.ai_protocol = 0;
hints.ai_canonname = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;

error = getaddrinfo(node, service, &hints, &result)