.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" May be distributed under the GNU General Public License .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sat Jul 24 21:29:05 1993 by Rik Faith (faith@cs.unc.edu) .TH BYTEORDER 3 "April 15, 1993" "BSD" "Linux Programmer's Manual" .SH NAME htonl, htons, ntohl, ntohs \- convert values between host and network byte order .SH SYNOPSIS .nf .B #include .sp .BI "unsigned long int htonl(unsigned long int " hostlong ); .sp .BI "unsigned short int htons(unsigned short int " hostshort ); .sp .BI "unsigned long int ntohl(unsigned long int " netlong ); .sp .BI "unsigned short int ntohs(unsigned short int " netshort ); .fi .SH DESCRIPTIO The \fBhtonl()\fP function converts the long integer \fIhostlong\fP from host byte order to network byte order. .PP The \fBhtons()\fP function converts the short integer \fIhostshort\fP from host byte order to network byte order. .PP The \fBntohl()\fP function converts the long integer \fInetlong\fP from network byte order to host byte order. .PP The \fBntohs()\fP function converts the short integer \fInetshort\fP from network byte order to host byte order. .PP On the i80x86 the host byte order is Least Significant Byte first, whereas the network byte order, as used on the Internet, is Most Significant Byte first. .SH "CONFORMING TO" BSD 4.3 .SH SEE ALSO .BR gethostbyname "(3), " getservent (3)