[erlang-questions] Writing platform independent Socket based binary parsing code
Sun May 13 23:49:09 CEST 2012
If the data are big-endian on the wire, use /big.
If the data are little-endian on the wire, use /little.
Use the *same* Erlang code to match the wire data
whether you are using a big-endian SPARC or a little-
> I am aware of the fact that from network we get data in our application in Big Endian format and in c/c++ I would use ntohs/ntohl functions for converting it into a format that the OS supports.
> But, the same in Erlang is confusing me (no idea why !!).
In effect, binary matching *is* ntoh... and binary
construction *is* hton...
More information about the erlang-questions