Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function converts a u_shortfrom TCP/IP network byte order to host byte order, which is little-endian on Intel processors.

Syntax

u_short ntohs(
  u_short 
netshort
);

Parameters

netshort

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

Return Value

This function returns the value in host byte order. If the netshortparameter was already in host byte order, then no operation is performed.

Remarks

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

Requirements

Header winsock2.h
Library Ws2.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also