OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man3 / getaddrinfo.3
index db7955b..bfcf6ba 100644 (file)
@@ -40,7 +40,7 @@
 .\" FIXME . glibc's 2.9 NEWS file documents DCCP and UDP-lite support
 .\"           and is SCTP support now also there?
 .\"
-.TH GETADDRINFO 3 2013-01-15 "GNU" "Linux Programmer's Manual"
+.TH GETADDRINFO 3 2014-04-06 "GNU" "Linux Programmer's Manual"
 .SH NAME
 getaddrinfo, freeaddrinfo, gai_strerror \- network address and
 service translation
@@ -176,7 +176,8 @@ Multiple flags are specified by bitwise OR-ing them together.
 .PP
 All the other fields in the structure pointed to by
 .I hints
-must contain either 0 or a NULL pointer, as appropriate.
+must contain either 0 or a null pointer, as appropriate.
+.PP
 Specifying
 .I hints
 as NULL is equivalent to setting
@@ -191,7 +192,9 @@ and
 .I ai_flags
 to
 .BR "(AI_V4MAPPED\ |\ AI_ADDRCONFIG)" .
-
+(POSIX specifies different defaults for
+.IR ai_flags ;
+see NOTES.)
 .I node
 specifies either a numerical network address
 (for IPv4, numbers-and-dots notation as supported by
@@ -203,7 +206,7 @@ If
 .I hints.ai_flags
 contains the
 .B AI_NUMERICHOST
-flag then
+flag, then
 .I node
 must be a numerical network address.
 The
@@ -382,6 +385,13 @@ IPv4 address configured, and IPv6 addresses are returned
 only if the local system has at least one IPv6 address configured.
 The loopback address is not considered for this case as valid
 as a configured address.
+This flag is useful on, for example,
+IPv4-only systems, to ensure that
+.BR getaddrinfo ()
+does not return IPv6 socket addresses that would always fail in
+.BR connect (2)
+or
+.BR bind (2).
 .PP
 If
 .I hints.ai_flags
@@ -706,8 +716,8 @@ main(int argc, char *argv[])
                         peer_addr_len, host, NI_MAXHOST,
                         service, NI_MAXSERV, NI_NUMERICSERV);
        if (s == 0)
-            printf("Received %ld bytes from %s:%s\\n",
-                    (long) nread, host, service);
+            printf("Received %zd bytes from %s:%s\\n",
+                    nread, host, service);
         else
             fprintf(stderr, "getnameinfo: %s\\n", gai_strerror(s));
 
@@ -808,7 +818,7 @@ main(int argc, char *argv[])
             exit(EXIT_FAILURE);
         }
 
-        printf("Received %ld bytes: %s\\n", (long) nread, buf);
+        printf("Received %zd bytes: %s\\n", nread, buf);
     }
 
     exit(EXIT_SUCCESS);
@@ -824,3 +834,12 @@ main(int argc, char *argv[])
 .BR gai.conf (5),
 .BR hostname (7),
 .BR ip (7)
+.SH COLOPHON
+This page is part of release 3.68 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.