Suppose we’re sending some data over the network … it is my understanding that Endianness is unconditionally an issue as we don’t know what receving machine expects and what sending machine will send. As a rule of thumb is this correct?
Does the answer depend on the type of data is being sent, say, does it matter if we’re sending a C-string vs, IEEE-style 4 byte float, for example?
Yes, endianness always needs to be considered and defined in a network protocol. It affects all types that are larger than a single byte. So a
charbased C-string will not be affected by it since it is just an array of single bytes, but awchar_tbased string needs to be converted if one of the machines is little endian and the other one big endian. The same applies to all larger types likesintandfloatetc..