.\" Copyright (c) 1983 Regents of the University of California. .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" .\" @(#)byteorder.3 6.1 (Berkeley) %G% .\" .TH BYTEORDER 3N "" .UC 5 .SH NAME htonl, htons, ntohl, ntohs \- convert values between host and network byte order .SH SYNOPSIS .nf .B #include .B #include .PP .B netlong = htonl(hostlong); .B u_long netlong, hostlong; .PP .B netshort = htons(hostshort); .B u_short netshort, hostshort; .PP .B hostlong = ntohl(netlong); .B u_long hostlong, netlong; .PP .B hostshort = ntohs(netshort); .B u_short hostshort, netshort; .fi .SH DESCRIPTION These routines convert 16 and 32 bit quantities between network byte order and host byte order. On machines such as the SUN these routines are defined as null macros in the include file .RI < netinet/in.h >. .PP These routines are most often used in conjunction with Internet addresses and ports as returned by .IR gethostent (3N) and .IR getservent (3N). .SH "SEE ALSO" gethostent(3N), getservent(3N) .SH BUGS The VAX handles bytes backwards from most everyone else in the world. This is not expected to be fixed in the near future.