1INET_NTOP(3)               Linux Programmer's Manual              INET_NTOP(3)
2
3
4

NAME

6       inet_ntop - convert IPv4 and IPv6 addresses from binary to text form
7

SYNOPSIS

9       #include <arpa/inet.h>
10
11       const char *inet_ntop(int af, const void *src,
12                             char *dst, socklen_t size);
13

DESCRIPTION

15       This  function  converts  the  network  address structure src in the af
16       address family into a character string.  The resulting string is copied
17       to the buffer pointed to by dst, which must be a non-NULL pointer.  The
18       caller specifies the number of bytes available in this  buffer  in  the
19       argument size.
20
21       inet_ntop()  extends  the  inet_ntoa(3)  function  to  support multiple
22       address families, inet_ntoa(3) is now considered to  be  deprecated  in
23       favor  of  inet_ntop().   The  following address families are currently
24       supported:
25
26       AF_INET
27              src points to a struct in_addr (in network byte order) which  is
28              converted  to an IPv4 network address in the dotted-decimal for‐
29              mat,  "ddd.ddd.ddd.ddd".   The  buffer  dst  must  be  at  least
30              INET_ADDRSTRLEN bytes long.
31
32       AF_INET6
33              src points to a struct in6_addr (in network byte order) which is
34              converted to a representation of this address in the most appro‐
35              priate IPv6 network address format for this address.  The buffer
36              dst must be at least INET6_ADDRSTRLEN bytes long.
37

RETURN VALUE

39       On success, inet_ntop() returns a non-NULL pointer  to  dst.   NULL  is
40       returned if there was an error, with errno set to indicate the error.
41

ERRORS

43       EAFNOSUPPORT
44              af was not a valid address family.
45
46       ENOSPC The  converted  address  string  would  exceed the size given by
47              size.
48

CONFORMING TO

50       POSIX.1-2001.  Note that RFC 2553 defines a prototype  where  the  last
51       argument  size is of type size_t.  Many systems follow RFC 2553.  Glibc
52       2.0 and 2.1 have size_t, but 2.2 and later have socklen_t.
53

BUGS

55       AF_INET6 converts IPv4-mapped IPv6 addresses into an IPv6 format.
56

EXAMPLE

58       See inet_pton(3).
59

SEE ALSO

61       getnameinfo(3), inet(3), inet_pton(3)
62

COLOPHON

64       This page is part of release 3.53 of the Linux  man-pages  project.   A
65       description  of  the project, and information about reporting bugs, can
66       be found at http://www.kernel.org/doc/man-pages/.
67
68
69
70Linux                             2008-11-11                      INET_NTOP(3)
Impressum