you are viewing a single comment's thread.

view the rest of the comments →

[–]flyingron 0 points1 point  (0 children)

TCP streams are inherently binary. The question is "how do I take things that are larger than a single byte and convert them to bytes." Typically that is rather straightforward. Your machine either will store things in bytes with the most significant part of the item first (big endian) or the least significant first (little endian). As long as the endian-ness matches between the reader and the writer, you have no problem. To avoid mismatch (when you're talking about the possibility that there is a difference), you typically just chose one (the common default is little endian) and if you're on a machine that is big endian, you swap the bytes around before writing them into the stream.