Re: i386 long Vs alpha long: htons/ntohs question.

From: Matti Aarnio (
Date: Tue Jan 25 2000 - 19:31:51 EST

On Thu, Jan 27, 2000 at 08:29:12AM +0100, Gigi Sullivan wrote:
> Ok, but what this means ?
> data = htonl(data);

        It means the result is defined for 32 bit data *only*.
        Calling some variable 'long' does not always mean it
        is *machine* long -- in the htonl() (Host TO Network Long)
        it is ALWAYS 32 bits.

> So my data (on alpha) will lost 4 bytes when I'll do
> htonl on it ?

        Just because htonl()/ntohl() are not defined for 64-bit 'long'.

        However do see how RPC's XDR handles 64-bit scalars, that should
        be most educative experience in data portability over the network.

> Thx a lot :))
> bye bye
> -- gg sullivan
> Lorenzo Cavallaro `Gigi Sullivan' <> -- ITALY

/Matti Aarnio
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to

This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:33 EST