Where is inet_aton? inet_ntoa? inet_addr?
Submitted by Community Manager on Tue, 04/15/2008 - 22:28.
Tagged with LSB
Printer-friendly version
The LSB specifies inet_ntop and inet_pton for address conversion, since these are both IPv4 and IPv6 capable. You can start using these functions by replacing calls of the form
foo.sin_addr.s_addr = inet_addr(cp);
with
inet_pton(AF_INET, cp, &foo.sin_addr);
calls of the form
inet_aton(cp, &foo.sin_addr);
with
inet_pton(AF_INET, cp, &foo.sin_addr);
and calls of the form
ptr = inet_ntoa(foo.sin_addr);
with
char str[INET_ADDRSTRLEN]; ptr = inet_ntop(AF_INET, &foo.sin_addr, str, sizeof(str));


