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

NAME

6       inet_ntop - Parse network address structures
7

SYNOPSIS

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

DESCRIPTION

17       This  function  converts  the  network  address structure src in the af
18       address family into a character string, which is copied to a  character
19       buffer dst, which is cnt bytes long.
20
21       inet_ntop(3)  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(3).   The following address families are currently
24       supported:
25
26       AF_INET
27              src points to a struct in_addr (network byte order format) which
28              is  converted to an IPv4 network address in the dotted-quad 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 (network byte order format)
34              which is converted to a representation of this  address  in  the
35              most  appropriate  IPv6 network address format for this address.
36              The buffer dst must be at least INET6_ADDRSTRLEN bytes long.
37

RETURN VALUE

39       inet_ntop() returns a non-null pointer to dst.   NULL  is  returned  if
40       there was an error, with errno set to EAFNOSUPPORT if af was not set to
41       a valid address family, or to ENOSPC if the  converted  address  string
42       would exceed the size of dst given by the cnt argument.
43

CONFORMING TO

45       POSIX.1-2001.   Note  that  RFC 2553 defines a prototype where the last
46       parameter cnt is of type size_t.  Many systems follow RFC 2553.   Glibc
47       2.0 and 2.1 have size_t, but 2.2 has socklen_t.
48

SEE ALSO

50       inet_pton(3)
51

BUGS

53       AF_INET6 converts IPv6-mapped IPv4 addresses into an IPv6 format.
54
55
56
57Linux Man Page                    2000-12-18                      inet_ntop(3)
Impressum