DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

byteorder(3N)


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

Synopsis

cc [options] file -lnsl
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>

in_addr_t htonl(in_addr_t hostlong);

in_port_t htons(in_port_t hostshort);

in_addr_t ntohl(in_addr_t netlong);

in_port_t ntohs(in_port_t netshort);

Description

These routines convert 16 and 32 bit quantities between network byte order and host byte order. On some architectures these routines are defined as NULL macros in the include file netinet/in.h. On other architectures, if their host byte order is different from network byte order, these routines are functional.

These routines are most often used in conjunction with Internet addresses and ports as returned by gethostent(3N) and getservent(3N).

Diagnostics

No errors are defined.

References

gethostent(3N), getservent(3N)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004