Re: [Freeciv-Dev] Endianess of packet data
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
David Pfitzner wrote:
>
> Which is why freeciv packets, to be machine independent, use a
> standard order ("network byte order") instead of the native
> endianness of the machine being used.
As lots of you know, there is a standard set of macros that people
can use to ensure that a packet has network-byte-order.
These standard macros are (usually) in #include <netinet/in.h>,
and are called htonl, htons, ntohl and ntohs. These are no-ops
on big-endian machines.
Regards,
Mitch.
--
| mailto:mjd@xxxxxxxxxx | Not the official view of: |
| mailto:mjd@xxxxxxxxxxxxxxxx | Australian Calculator Opn |
| Certified Linux Evangelist! | Hewlett Packard Australia |
|
|