1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)byteorder.3 8.1 (Berkeley) 06/04/93 7.\" 8.Dd 9.Dt BYTEORDER 3 10.Os BSD 4.2 11.Sh NAME 12.Nm htonl , 13.Nm htons , 14.Nm ntohl , 15.Nm ntohs 16.Nd convert values between host and network byte order 17.Sh SYNOPSIS 18.Fd #include <sys/param.h> 19.Ft u_long 20.Fn htonl "u_long hostlong" 21.Ft u_short 22.Fn htons "u_short hostshort" 23.Ft u_long 24.Fn ntohl "u_long netlong" 25.Ft u_short 26.Fn ntohs "u_short netshort" 27.Sh DESCRIPTION 28These routines convert 16 and 32 bit quantities between network 29byte order and host byte order. 30On machines which have a byte order which is the same as the network 31order, routines are defined as null macros. 32.Pp 33These routines are most often used in conjunction with Internet 34addresses and ports as returned by 35.Xr gethostbyname 3 36and 37.Xr getservent 3 . 38.Sh SEE ALSO 39.Xr gethostbyname 3 , 40.Xr getservent 3 41.Sh HISTORY 42The 43.Nm byteorder 44functions appeared in 45.Bx 4.2 . 46.Sh BUGS 47On the 48.Tn VAX 49bytes are handled backwards from most everyone else in 50the world. This is not expected to be fixed in the near future. 51