The Windows Sockets WSANtohs function converts a u_short from network byte order to host byte order.
int WSANtohs (
SOCKET s,
u_short netshort,
u_short FAR * lphostshort
);
The WSANtohs function takes a 16-bit number in the network byte order associated with socket s and returns a 16-bit number pointed to by the lphostshort parameter in host byte order.
If no error occurs, WSANtohs returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
WSANOTINITIALISED | A successful WSAStartup must occur before using this function. |
WSAENETDOWN | The network subsystem has failed. |
WSAENOTSOCK | The descriptor is not a socket. |
WSAEFAULT | The lphostshort parameter is not completely contained in a valid part of the user address space. |
Windows NT: Yes
Windows: Yes
Windows CE: Unsupported.
Header: Declared in winsock2.h.
Import Library: Link with ws2_32.lib.
htonl, htons, ntohl, ntohs, WSAHtonl, WSANtohl, WSAHtons