The Windows Sockets WSAHtonl function converts a u_long from host byte order to network byte order.
int WSAHtonl (
SOCKET s,
u_long hostlong,
u_long FAR * lpnetlong
);
The WSAHtonl function takes a 32-bit number in host byte order and returns a 32-bit number pointed to by the lpnetlong parameter in the network byte order associated with socket s.
If no error occurs, WSAHtonl 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 lpnetlong 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, WSANtohl, WSAHtons, WSANtohs