Remove mention of sa_len field from example code.

That field is a BSDism not present on Linux.
This commit is contained in:
Michael Kerrisk 2008-06-13 09:54:52 +00:00
parent cd117d4875
commit 481c58cae6
1 changed files with 4 additions and 2 deletions

View File

@ -221,9 +221,10 @@ a particular address family.
.in +4n
.nf
struct sockaddr *sa; /* input */
socklent_t len; /* input */
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
if (getnameinfo(sa, sa\->sa_len, hbuf, sizeof(hbuf), sbuf,
if (getnameinfo(sa, len, hbuf, sizeof(hbuf), sbuf,
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0)
printf("host=%s, serv=%s\en", hbuf, sbuf);
.fi
@ -235,9 +236,10 @@ reverse address mapping.
.in +4n
.nf
struct sockaddr *sa; /* input */
socklent_t len; /* input */
char hbuf[NI_MAXHOST];
if (getnameinfo(sa, sa\->sa_len, hbuf, sizeof(hbuf),
if (getnameinfo(sa, len, hbuf, sizeof(hbuf),
NULL, 0, NI_NAMEREQD))
printf("could not resolve hostname");
else