DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

byteorder(SLIB-osr5)


byteorder: htons, htonl, ntohl, ntohs -- convert values between host and network byte order

Syntax

cc ... -lsocket

#include  <sys/types.h>
#include  <netinet/in.h>

u_long htonl(hostlong); u_long hostlong;

u_short htons(hostshort); u_short hostshort;

u_long ntohl(netlong); u_long netlong;

u_short ntohs(netshort); u_short netshort;

Description

These routines convert 16 and 32 bit quantities between network byte order and host byte order.

These routines are most often used in conjunction with Internet addresses and ports as returned by gethostbyname(SLIB-osr5) and getservent(SLIB-osr5).

See also

gethostbyname(SLIB-osr5), getservent(SLIB-osr5)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005