OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man3 / byteorder.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 21:29:05 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Thu Jul 26 14:06:20 2001 by Andries Brouwer (aeb@cwi.nl)
29 .\"
30 .TH BYTEORDER 3  2009-01-15 "GNU" "Linux Programmer's Manual"
31 .SH NAME
32 htonl, htons, ntohl, ntohs \- convert values between host and network
33 byte order
34 .SH SYNOPSIS
35 .nf
36 .B #include <arpa/inet.h>
37 .sp
38 .BI "uint32_t htonl(uint32_t " hostlong );
39 .sp
40 .BI "uint16_t htons(uint16_t " hostshort );
41 .sp
42 .BI "uint32_t ntohl(uint32_t " netlong );
43 .sp
44 .BI "uint16_t ntohs(uint16_t " netshort );
45 .fi
46 .SH DESCRIPTION
47 The
48 .BR htonl ()
49 function converts the unsigned integer \fIhostlong\fP
50 from host byte order to network byte order.
51 .PP
52 The
53 .BR htons ()
54 function converts the unsigned short integer \fIhostshort\fP
55 from host byte order to network byte order.
56 .PP
57 The
58 .BR ntohl ()
59 function converts the unsigned integer \fInetlong\fP
60 from network byte order to host byte order.
61 .PP
62 The
63 .BR ntohs ()
64 function converts the unsigned short integer \fInetshort\fP
65 from network byte order to host byte order.
66 .PP
67 On the i386 the host byte order is Least Significant Byte first,
68 whereas the network byte order, as used on the Internet, is Most
69 Significant Byte first.
70 .SH "CONFORMING TO"
71 POSIX.1-2001.
72
73 Some systems require the inclusion of
74 .I <netinet/in.h>
75 instead of
76 .IR <arpa/inet.h> .
77 .SH "SEE ALSO"
78 .BR endian (3),
79 .BR gethostbyname (3),
80 .BR getservent (3)