htonl function
The htonl function converts a u_long from host to TCP/IP network byte order (which is big-endian).
Syntax
u_long WSAAPI htonl( _In_ u_long hostlong );
Parameters
- hostlong [in]
-
A 32-bit number in host byte order.
Return value
The htonl function returns the value in TCP/IP's network byte order.
Remarks
The htonl function takes a 32-bit number in host byte order and returns a 32-bit number in the network byte order used in TCP/IP networks (the AF_INET or AF_INET6 address family).
The htonl function can be used to convert an IPv4 address in host byte order to the IPv4 address in network byte order. This function does not do any checking to determine if the hostlong parameter is a valid IPv4 address.
The htonl function does not require that the Winsock DLL has previously been loaded with a successful call to the WSAStartup function.
(Windows Store apps): This API is supported.
Requirements
|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server | Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- htond
- htonf
- htonll
- htons
- inet_addr
- inet_ntoa
- InetNtop
- InetPton
- ntohd
- ntohf
- ntohll
- ntohs
- WSAHtonl
- WSAHtons
- WSANtohl
- WSANtohs
Send comments about this topic to Microsoft
Build date: 11/29/2012