1htonl(3XNET)     X/Open Networking Services Library Functions     htonl(3XNET)
2
3
4

NAME

6       htonl,  htons,  ntohl,  ntohs - convert values between host and network
7       byte order
8

SYNOPSIS

10       cc [ flag ... ] file ... -lxnet [ library ... ]
11       #include <arpa/inet.h>
12
13       uint32_t htonl(uint32_t hostlong);
14
15
16       uint16_t htons(uint16_t hostshort);
17
18
19       uint32_t ntohl(uint32_t netlong);
20
21
22       uint16_t  ntohs(uint16_t  netshort);
23
24

DESCRIPTION

26       These functions convert 16-bit and 32-bit  quantities  between  network
27       byte order and host byte order.
28
29
30       The   uint32_t  and   uint16_t types are made available by inclusion of
31       <inttypes.h>.
32

USAGE

34       These functions are  most  often  used  in  conjunction  with  Internet
35       addresses  and  ports  as  returned  by  gethostent(3XNET)  and getser‐
36       vent(3XNET).
37
38
39       On some architectures these functions are defined as macros that expand
40       to the value of their argument.
41

RETURN VALUES

43       The  htonl()  and htons() functions return the argument value converted
44       from host to network byte order.
45
46
47       The ntohl() and ntohs() functions return the argument  value  converted
48       from network to host byte order.
49

ERRORS

51       No errors are defined.
52

ATTRIBUTES

54       See attributes(5) for descriptions of the following attributes:
55
56
57
58
59       ┌─────────────────────────────┬─────────────────────────────┐
60       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
61       ├─────────────────────────────┼─────────────────────────────┤
62       │Interface Stability          │Standard                     │
63       ├─────────────────────────────┼─────────────────────────────┤
64       │MT-Level                     │MT-Safe                      │
65       └─────────────────────────────┴─────────────────────────────┘
66

SEE ALSO

68       endhostent(3XNET), endservent(3XNET), attributes(5), standards(5)
69
70
71
72SunOS 5.11                        10 Jun 2002                     htonl(3XNET)
Impressum