htons

This function converts a u_short from host byte order to network byte order.

At a Glance

Header file: Winsock.h
Windows CE versions: 1.0 and later

Syntax

u_short htons (u_short hostshort);

Parameters

hostshort

[in] 16-bit number in host byte order.

Return Values

The value in TCP/IP network byte order indicates success.

Remarks

The htons function takes a 16-bit number in host byte order and returns a 16-bit number in network byte order used in TCP/IP networks.

See Also

htonl, ntohl, ntohs