Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The ntohs function converts a u_short from TCP/IP network byte order to host byte order (which is little-endian on Intel processors).
u_short ntohs(
[in] u_short netshort
);
[in] netshort
A 16-bit number in TCP/IP network byte order.
The ntohs function returns the value in host byte order. If the netshort parameter is already in host byte order, then this function will reverse it. It is up to the application to determine if the byte order must be reversed.
The ntohs function takes a 16-bit number in TCP/IP network byte order (the AF_INET or AF_INET6 address family) and returns a 16-bit number in host byte order.
The ntohs function can be used to convert an IP port number in network byte order to the IP port number in host byte order.
The ntohs function does not require that the Winsock DLL has previously been loaded with a successful call to the WSAStartup function.
Windows 8.1 and Windows Server 2012 R2: This function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.
Requirement | Value |
---|---|
Minimum supported client | Windows 8.1, Windows Vista [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | winsock.h (include Winsock2.h) |
Library | Ws2_32.lib |
DLL | Ws2_32.dll |
Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register today