The socket call translates a long integer from host-byte order to network-byte order.
Syntax
htonl( a )
Parameters
a
integer (whole) number to be converted to/from network-byte order (on little endian systems).
Description
htonl(...) call convert an host-byte order integer to internet network-byte order.
htonl(...) call also convert an internet network-byte order integer to host-byte order.
The internet network requires addresses and ports in network standard-byte order.
Use the htonl(...) call to convert the host integer representation of addresses and ports to internet network-byte order.
Returns
The translated integer
Example:
SAY htonl( 16384 ) //4194304
SAY htonl( 4194304 ) //16384
Code:
htonl: PROCEDURE
hex = D2X( ARG( 1 ) )
exp = ''
DO i = 1 TO LENGTH( hex ) BY 8
exp = STRIP( TRANSLATE( '12345678', RIGHT( STRIP( SUBSTR( hex, i, 8 ) ), 8, '0' ), '78563412' ) )||exp
END
RETURN X2D( exp )
ClamAV use it for zINSTREAM
Other applications that communicate over the network
Regards,
//Jan-Erik