Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

htons(3) OSS Library Calls Reference Manual
NAME
htons - Converts a 16-bit integer from host byte order to Internet network byte order
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
H-series OSS processes: /G/system/zdllnnn/zinetdll
SYNOPSIS
#include <arpa/inet.h>
in_port_t htons(
in_port_t hostshort);
PARAMETERS
hostshort Species a 16-bit integer in host byte order.
DESCRIPTION
The htons() (host-to-network short) function converts a 16-bit integer from host byte order to
Internet network byte order. The htons() function is provided for compatibility with the XPG4
specication.
htons( ) is most often used to convert the values returned by gethostent() and getservent().
RETURN VALUES
The htons() function returns a 16-bit integer in Internet network byte order.
ERRORS
The htons() function does not set errno.
RELATED INFORMATION
Functions: htonl(3), ntohl(3), ntohs(3).
3102 Hewlett-Packard Company 527187-004