Today in the company asked the boss, the company's project Bottom, is the use of TCP, because of reliable, automatic disconnection, in the bottom of the implementation, but I remember TCP will also have a swap problem, so this article was born--on the problem of TCP swap, TCP is based on unreliable networks to achieve reliable transmission, There is certainly a case for the substitution.
If there is missing data or drops in the communication, the most likely problem is the process of sending the program or the process of receiving it.
For example, the server to send a large number of data to the client, send the frequency is very high, then there may be errors in the send (the reason may be many, may be the program processing logic problems, multi-threaded synchronization problems, buffer overflow problems, etc.), if the send failed to do the processing of re-sending data, Then the client will receive less data than the theory should receive, it will result in the loss of data, packet loss phenomenon. This phenomenon, in essence, is not to lose packets, nor to lose data, just because the program processing errors, resulting in some data is not successfully sent by the socket. Common solutions are as follows: unpacking, adding Baotou, sending, combined package, if the client, the service end of the line, often using heartbeat test.
A summary of the causes of TCP communication packet loss