1 .\" Copyright 2000 Sam Varshavchik <mrsam@courier-mta.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References: RFC 2553
26 .TH INET_NTOP 3 2021-03-22 "Linux" "Linux Programmer's Manual"
28 inet_ntop \- convert IPv4 and IPv6 addresses from binary to text form
31 .B #include <arpa/inet.h>
33 .BI "const char *inet_ntop(int " af ", const void *restrict " src ,
34 .BI " char *restrict " dst ", socklen_t " size );
37 This function converts the network address structure
41 address family into a character string.
42 The resulting string is copied to the buffer pointed to by
44 which must be a non-null pointer.
45 The caller specifies the number of bytes available in this buffer in
52 function to support multiple address families,
54 is now considered to be deprecated in favor of
56 The following address families are currently supported:
62 (in network byte order)
63 which is converted to an IPv4 network address in
64 the dotted-decimal format, "\fIddd.ddd.ddd.ddd\fP".
75 (in network byte order)
76 which is converted to a representation of this address in the
77 most appropriate IPv6 network address format for this address.
86 returns a non-null pointer to
88 NULL is returned if there was an error, with
90 set to indicate the error.
95 was not a valid address family.
98 The converted address string would exceed the size given by
101 For an explanation of the terms used in this section, see
109 Interface Attribute Value
112 T} Thread safety MT-Safe locale
118 POSIX.1-2001, POSIX.1-2008.
119 Note that RFC\ 2553 defines a prototype where the last argument
123 Many systems follow RFC\ 2553.
124 Glibc 2.0 and 2.1 have
126 but 2.2 and later have
128 .\" 2.1.3: size_t, 2.1.91: socklen_t
131 converts IPv4-mapped IPv6 addresses into an IPv6 format.