Converts an unsigned long integer from Internet network standard byte order to host byte order.
ISODE Library (libisode.a)
#include <sys/types.h>
#include <netinet/in.h>
uint32_t ntohl ( NetLong)
uint32_t NetLong;
The ntohl subroutine converts an unsigned long (32-bit) integer from Internet network standard byte order to host byte order.
Receiving hosts require addresses and ports in host byte order. Use the ntohl subroutine to convert Internet addresses and ports to the host integer representation.
The ntohl subroutine is defined in the net/nh.h file as a null macro if the host byte order is same as the network byte order.
The ntohl subroutine is declared in the net/nh.h file as a function if the host byte order is not same as the network byte order.
All applications containing the ntohl subroutine must be compiled with the _BSD macro set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.
Item | Description |
---|---|
NetLong | Requires a 32-bit integer in network byte order. |
The ntohl subroutine returns a 32-bit integer in host byte order.