1INET_ADDR(P)               POSIX Programmer's Manual              INET_ADDR(P)
2
3
4

NAME

6       inet_addr, inet_ntoa - IPv4 address manipulation
7

SYNOPSIS

9       #include <arpa/inet.h>
10
11       in_addr_t inet_addr(const char *cp);
12       char *inet_ntoa(struct in_addr in);
13
14

DESCRIPTION

16       The  inet_addr() function shall convert the string pointed to by cp, in
17       the standard IPv4 dotted decimal notation, to an integer value suitable
18       for use as an Internet address.
19
20       The inet_ntoa() function shall convert the Internet host address speciā€
21       fied by in to a string in the Internet standard dot notation.
22
23       The inet_ntoa() function need not be reentrant. A function that is  not
24       required to be reentrant is not required to be thread-safe.
25
26       All  Internet  addresses  shall  be  returned  in  network order (bytes
27       ordered from left to right).
28
29       Values specified using IPv4 dotted decimal notation  take  one  of  the
30       following forms:
31
32       a.b.c.d
33              When  four  parts  are specified, each shall be interpreted as a
34              byte of data and assigned, from left to right, to the four bytes
35              of an Internet address.
36
37       a.b.c  When  a  three-part address is specified, the last part shall be
38              interpreted as a 16-bit quantity and placed in the rightmost two
39              bytes  of the network address. This makes the three-part address
40              format convenient for specifying Class B  network  addresses  as
41              "128.net.host" .
42
43       a.b    When  a  two-part  address  is  supplied, the last part shall be
44              interpreted as a 24-bit quantity and  placed  in  the  rightmost
45              three  bytes  of  the  network  address. This makes the two-part
46              address  format  convenient  for  specifying  Class  A   network
47              addresses as "net.host" .
48
49       a      When  only one part is given, the value shall be stored directly
50              in the network address without any byte rearrangement.
51
52
53       All numbers supplied as parts in IPv4 dotted decimal  notation  may  be
54       decimal,  octal,  or  hexadecimal,  as  specified in the ISO C standard
55       (that is, a leading 0x or 0X implies hexadecimal; otherwise, a  leading
56       '0' implies octal; otherwise, the number is interpreted as decimal).
57

RETURN VALUE

59       Upon  successful  completion,  inet_addr()  shall  return  the Internet
60       address. Otherwise, it shall return ( in_addr_t)(-1).
61
62       The inet_ntoa() function shall return a pointer to the network  address
63       in Internet standard dot notation.
64

ERRORS

66       No errors are defined.
67
68       The following sections are informative.
69

EXAMPLES

71       None.
72

APPLICATION USAGE

74       The  return  value  of inet_ntoa() may point to static data that may be
75       overwritten by subsequent calls to inet_ntoa().
76

RATIONALE

78       None.
79

FUTURE DIRECTIONS

81       None.
82

SEE ALSO

84       endhostent()  ,  endnetent()  ,  the   Base   Definitions   volume   of
85       IEEE Std 1003.1-2001, <arpa/inet.h>
86
88       Portions  of  this text are reprinted and reproduced in electronic form
89       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
90       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
91       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
92       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
93       event of any discrepancy between this version and the original IEEE and
94       The  Open Group Standard, the original IEEE and The Open Group Standard
95       is the referee document. The original Standard can be  obtained  online
96       at http://www.opengroup.org/unix/online.html .
97
98
99
100IEEE/The Open Group                  2003                         INET_ADDR(P)
Impressum