Home  >  Article  >  What is tcp sticky packet?

What is tcp sticky packet?

coldplay.xixi
coldplay.xixiOriginal
2020-06-28 13:12:124683browse

tcp sticky packet means that several packets of data sent by the sender are stuck into one packet when they arrive at the receiver. From the receiving buffer, the head of the next packet of data is immediately following the end of the previous packet of data. There are many reasons for sticky packets, which may come from the sender or the receiver.

What is tcp sticky packet?

#1. What is the TCP sticky problem?

TCP sticky packet means that several packets of data sent by the sender are stuck into one packet when they arrive at the receiver. From the receiving buffer, the header of the latter packet of data follows the previous packet of data. At the end, there are many reasons for sticky packets, which may come from the sender or the receiver.

Related learning recommendations: PHP Programming from beginner to proficient

2. Reasons for TCP sticky packets

(1) Sender reasons

TCP The Nagle algorithm is used by default (main function: reducing the number of message segments in the network), and the Nagle algorithm mainly does two things:

a: Only when the previous packet is confirmed will the next packet be sent

b: Collect multiple small packets and send them together when a confirmation arrives

The Nagle algorithm may cause the sender to have a sticky problem

(2) Reasons for the receiver

When TCP receives a data packet, it will not be handed over to the application layer for processing immediately, or the application layer will not process it immediately. In fact, TCP saves the received data packets in the receive cache, and then the application actively reads the received packets from the cache. In this way, if the speed at which TCP receives data packets into the cache is greater than the speed at which the application reads data packets from the cache, multiple packets will be cached, and the application may read multiple packets linked end to end. package.

3. When do you need to deal with the sticking phenomenon?

a: If the multiple sets of data sent by the sender are originally different parts of the same piece of data, for example, a file is divided into multiple parts and sent, then of course there is no need to deal with the sticky phenomenon

b: If multiple groups are unrelated or even parallel, then the sticky phenomenon must be dealt with at this time

The above is the detailed content of What is tcp sticky packet?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn