The Windows Sockets htons function converts a u_short from host to TCP/IP network byte order (which is big-endian).
u_short htons (
  u_short hostshort  
);
 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.
The htons function returns the value in TCP/IP network byte order.
  Windows NT:  Yes
  Windows: Yes
  Windows CE:  Use version 1.0 and later.
  Header: Declared in winsock2.h.
  Import Library: Link with ws2_32.lib.
htonl, ntohl, ntohs, WSAHtonl, WSAHtons, WSANtohl, WSANtohs