htonl

Converts 32-bit quantities from host to network byte order.

Library:LibC
Standard:BSD
Service:Networking

Syntax

  #include <sys/byteorder.h> 
   
  unsigned long htonl (
     unsigned long   hostlong);
  

Parameters

hostlong

(IN) Specifies a 32-bit quantity in host byte order.

Return Values

Returns the value converted from host to network byte order.

Remarks

The htonl function is frequently used to convert Internet addresses from host byte order to network byte order for socket calls requiring an Internet address as a parameter.

NOTE:Network data order places the most significant byte at the lower memory address, while host data order places the least significant byte at the lower address.

See Also