The ntohs function


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


The system include file contains the following declarations for the u_short type, and the ntohs function:

 u_short = shortint;

 function ntohs(netshort : u_short) : u_short;
  external dll='ws2_32.dll';


The only argument passed to the ntohs function is the u_short value that you want to convert to host byte order.

Return Values

The ntohs function returns the u_short value in host byte order.

Reference Information

The authoritative source of information about the WinSock2 library is the Microsoft Developers Network (MSDN). You can access the MSDN on the Microsoft website at