I was reading this thread and noticed in the solution that if you send the length of the data separate from the actual data Nagle's algorithm may come in to play and desync the data sent.
I was wondering about this because a lot of code samples I see the client sends the length of the data first and then the data itself as to separate calls. Was this problem not affecting them somehow?
Should I concatenate the length of the data and the data itself in to a single byte array and send that in one go? If so, is there a better way to concatenate the two byte arrays without manually copying all the data from both (loops) in to the new one? Seems pretty inefficient for something that would have to occur so often (every time the user or server sends data between each other).