htons

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function converts a u_short from host to TCP/IP network byte order, which is big-endian.


u_short htons(
  u_short hostshort
);

hostshort

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

This 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.

This function returns the value in TCP/IP network byte order.

Headerwinsock2.h
LibraryWs2.lib
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show: