Socket plastic garbled
What is the purpose of repeating these two sentences?

bytes = newSocket。 Receive (recByteMsg, recByteMsg. Length, 0);

RecMsg = code. GetEncoding("GB23 12 ")。 GetString(recByteMsg,0,bytes);

bytes = newSocket。 Receive (recByteMsg, recByteMsg. Length, 0);

RecMsg = code. GetEncoding("GB23 12 ")。 GetString(recByteMsg,0,bytes);

If you use blocking mode, you don't need to write repeatedly. Of course, blocking mode may cause packet adhesion problems.

Generally, we use the sender to set the boundary flag, and the receiver distinguishes the upper and lower packets according to the flag, just like the header flag of IP packets. If the sent character length is fixed, there is no need to set the boundary flag.