Converts an unsigned long integer from host byte order to Internet network byte order.
#include <sys/types.h> #include <netinet/in.h>
unsigned long htonl ( HostLong)
unsigned long HostLong;
The htonl subroutine converts an unsigned long (32-bit) integer from host byte order to Internet network byte order.
The Internet network requires addresses and ports in network standard byte order. Use the htonl subroutine to convert the host integer representation of addresses and ports to Internet network byte order.
The htonl subroutine is defined in the net/nh.h file as a macro.
HostLong | Specifies a 32-bit integer in host byte order. |
The htonl subroutine returns a 32-bit integer in Internet network byte order (most significant byte first).
The htonl subroutine is part of Base Operating System (BOS) Runtime.
All applications containing the htonl subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.
The htons subroutine, ntohl subroutine, ntohs subroutine.
Sockets Overview in AIX 5L Version 5.1 Communications Programming Concepts.