|
Home > Archive > Unix Programming > May 2005 > communication between big endian and little endian machines
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
communication between big endian and little endian machines
|
|
| junky_fellow@yahoo.co.in 2005-05-18, 2:49 am |
| How two machines with different byte alignment and byte endian
may communicate ?
| |
| Stephane Zuckerman 2005-05-18, 7:53 am |
| > How two machines with different byte alignment and byte endian
> may communicate ?
If it's just about integers (long, int, short, etc.), then use the
hto*/nto* functions (ntohl, htonl, etc.).
If you want to use floating point variables, try looking the xdr library.
--
"Je deteste les ordinateurs : ils font toujours ce que je dis, jamais ce
que je veux !"
"The obvious mathematical breakthrough would be development of an easy
way to factor large prime numbers." (Bill Gates, The Road Ahead)
| |
| loic-dev@gmx.net 2005-05-18, 7:53 am |
| Hi,
> How two machines with different byte alignment and byte endian
> may communicate ?
Both machines agree to a common format to use (byte alignment and byte
endianess). The machines convert their native representations to that
format before sending and convert back when receiving.
Common formats used are string, XDR and ASN.1.
Cheers,
Loic.
| |
| Fletcher Glenn 2005-05-18, 6:03 pm |
| loic-dev@gmx.net wrote:
> Hi,
>
>
>
>
> Both machines agree to a common format to use (byte alignment and byte
> endianess). The machines convert their native representations to that
> format before sending and convert back when receiving.
>
> Common formats used are string, XDR and ASN.1.
>
> Cheers,
> Loic.
>
You should also be aware that without something like XDR or xml, you
cannot reliably send things like structs or other binary representations.
--
Fletcher Glenn
|
|
|
|
|