ntohs

The Windows Sockets ntohs function converts a u_short from TCP/IP network byte order to host byte order (which is big-endian).

u_short ntohs (
  u_short netshort  
);
 

Parameters

netshort
[in] A 16-bit number in TCP/IP network byte order.

Remarks

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

Return Values

The ntohs function returns the value in host byte order. If the netshort parameter was already in host byte order, then no operation is performed.

QuickInfo

  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.

See Also

htonl, htons, ntohl, WSAHtonl, WSAHtons, WSANtohl, WSANtohs