Martin Honnen wrote:
Quote:
Kelvin wrote:
How can I do a host to network conversion (similar to htonl) in
JavaScript? i.e. convert to network byte order irrespective of whether
host is little or big endian.
JavaScript (at least 1.x) does not have a byte data type so I am not
sure where you are dealing with bytes and endianness at all. In what
context/host are you using JavaScript?
OK, let me try to make this clearer. In C htonl will convert an IP
|
address from host byte order to network byte order. On a big endian
processor it does nothing and on a little endian one it reverses the
order of the 4 bytes that make up the address. Is there a similar
function in JavaScript?
K