TCP/IP Programming Manual

Errors
Upon successful completion, this function returns a pointer to the dst buffer. Otherwise, this function
returns NULL and errno is set to indicate the error. If any of these conditions occurs, the function
sets errno to the corresponding value:
The value specified for the af parameter is not valid.EAFNOSUPPORT
The value specified for the size parameter is not valid for the address family.ENOSPC
Usage Guidelines
The inet_ntop function is one of two functions that allow you to manage network addresses
regardless of the address family.
inet_pton
The inet_pton function converts a character string to an IPv6 or IPv4 binary address. (This
function is supported for NonStop TCP/IPv6 only.)
NOTE: The C synopsis is given in ANSI C format rather than the pre-ANSI C formats of the other
library routines because the only NonStop servers you can use these routines on all support ANSI
C. (ANSI C format defines the function and the arguments in the same line rather than using an
assign statement and defining the arguments underneath.)
C Synopsis
#include <netdb.h>
int inet_pton(int af, const char *src, void *dst);
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
error = inet_pton(af, src, dst);
INT error;
INT af;
STRING .EXT src;
STRING .EXT dst;
af
input value; specifies the address family for the address to be converted. Valid values are:
AF_INET
indicates an IPv4 address
AF_INET6
indicates an IPv6 address
src
input value; points to the text string version of the address to be converted. This parameter
cannot be a null pointer. src has one of the following forms:
IPv4 dotted decimal format as ddd.ddd.ddd.ddd, for example:
172.17.201.43
IPv6 hexadecimal string format as x:x:x:x:x:x:x:x, for example:
1080:0:0:0:8:800:200C:417A
Compressed hexadecimal string format that omits zero values, for example:
inet_pton 139