www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


htonl

Converts a 32 bit long word from host to TCP/IP network byte order.

unsigned long htonl ( unsigned long hostlong );

Parameters

hostlong

32 bit value whose byte order is to be swapped

Return Value

input value returned with byte order swapped

Comments

This function converts the provided 32 bit value from Intel byte ordering (little endian) to network byte order (big endian), or vice-versa.

For example, calling with input value 0x12345678 will return the value 0x78563412.

No entry into the @CHIP-RTOS API is made here.   This action is taken immediately within this library call.

The macro ntohl shown below is defined for use where you want to state that the conversion is from network byte order to host byte order.   Either way, the same library code does the job.

            
 #define  ntohl htonl

See Also


This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document