In article <00ae01c3f6f2$0021a7b0$210d640a@unfix.org> (at Thu, 19 Feb 2004 15:09:32 +0100), "Jeroen Massar" <jeroen@unfix.org> says: > A small google on getnameinfo() and sa_len produced that > Linux apparently doesn't have any sa_len field in the sockaddr > structures, while every other OS (including your beloved Windows ;) > and the various BSD's have it, apparently it is 'optional', but > from the EXAMPLES section on a Debian unstable's getnameinfo(3) page: I don't think Windows, Solaris, AIX , HP/UX, Irix, Tru64 ... (not in particular order) has sa_len field in the sockaddr{}. > struct sockaddr *sa; /* input */ > char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; > > if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf, > sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0) > printf("host=%s, serv=%s\n", hbuf, sbuf); : > So what is up with the documentation, or better, how can I as an > application programmer get a valid sa_len for getnameinfo() ? :) Well, the style of this code is not good. Salen should be given to this "function." (Or you've got via 3rd argument of get{sock,peer}name()). -- Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html