Question: I'm writing a program that uses QUdpSocket for transmitting data over the network. This is my first socket program, and I've come across an interesting problem called Endianness.

My actual question in, do I have to worry about Endianness when I'm using QNetwork as my sockets library? If I do have to worry, what do I have to do to properly avoid Endianness problems?

Answer: 
Here's a simple test for big endianness, in case you want it:

// This test assumes an int size of at least 2.

static const int testValue = 1;

#define is\_bigendian() ( (*(char*)&testValue) == 0 )

bool CD\_is\_bigendian(void)
{
 return is\_bigendian();
}
Intel CPUs use little endian. Most everything else is big endian. The default network byte order is big endian.

To test if endianness is a problem, send the value 0x12345678 and check if it makes it as the same or 0x78563412. If the value on the receiving computer is the later value, then the endianness is not the same between the two systems.

Check [this wikipedia article](http://en.wikipedia.org/wiki/Endianness) for info on endianness.