Skip to content

Instantly share code, notes, and snippets.

@josser
Created February 11, 2015 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josser/ccad69a7c767aa0d3159 to your computer and use it in GitHub Desktop.
Save josser/ccad69a7c767aa0d3159 to your computer and use it in GitHub Desktop.
ai_flags The ai_flags field to which the hints parameter points
shall be set to zero or be the bitwise-inclusive OR of one
or more of the values AI_ADDRCONFIG, AI_CANONNAME,
AI_NUMERICHOST, AI_NUMERICSERV and AI_PASSIVE.
AI_ADDRCONFIG If the AI_ADDRCONFIG bit is set, IPv4
addresses shall be returned only if an
IPv4 address is configured on the local
system, and IPv6 addresses shall be
returned only if an IPv6 address is con‐
figured on the local system.
AI_CANONNAME If the AI_CANONNAME bit is set, a success‐
ful call to getaddrinfo() will return a
NUL-terminated string containing the
canonical name of the specified hostname
in the ai_canonname element of the first
addrinfo structure returned.
AI_NUMERICHOST If the AI_NUMERICHOST bit is set, it indi‐
cates that hostname should be treated as a
numeric string defining an IPv4 or IPv6
address and no name resolution should be
attempted.
AI_NUMERICSERV If the AI_NUMERICSERV bit is set, then a
non-null servname string supplied shall be
a numeric port string. Otherwise, an
EAI_NONAME error shall be returned. This
bit shall prevent any type of name resolu‐
tion service (for example, NIS+) from
being invoked.
AI_PASSIVE If the AI_PASSIVE bit is set it indicates
that the returned socket address structure
is intended for use in a call to bind(2).
In this case, if the hostname argument is
the null pointer, then the IP address por‐
tion of the socket address structure will
be set to INADDR_ANY for an IPv4 address
or IN6ADDR_ANY_INIT for an IPv6 address.
If the AI_PASSIVE bit is not set, the
returned socket address structure will be
ready for use in a call to connect(2) for
a connection-oriented protocol or
connect(2), sendto(2), or sendmsg(2) if a
connectionless protocol was chosen. The
IP address portion of the socket address
structure will be set to the loopback
address if hostname is the null pointer
and AI_PASSIVE is not set.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment