Compartilhar via


htons (Compact 2013)

3/26/2014

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

Syntax

u_short htons(
  u_short hostshort
);

Parameters

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

Remarks

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.

Return Value

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

Requirements

Header

winsock2.h

Library

Ws2.lib

See Also

Reference

Socket Functions
htonl
ntohl
ntohs
WSAHtonl
WSAHtons
WSANtohl
WSANtohs