Talk about how tcp stick package is produced? (undone)

1. What is tcp stick package?

A plurality of data packets sent by the sender, the recipient buffer to the end to end, into a stick pack is received.

 

2, reason

May be a plurality of TCP protocol packets will be sent to the recipient using the default Nagle algorithm.

Application reads the data packet cache speed less than the speed of the received data packet, a plurality of cache data packets will be treated as an application package once read.

 

3, processing method

The sender uses TCP_NODELAY option to turn off the Nagle algorithm

Increasing the starting symbol and a packet end, the application reads, distinguishing packets.

In the header packet define the length of the entire packet, the application reads the first length of the packet, and then reads the byte data packet entire length, to ensure a single packet and the read is complete.

Guess you like

Origin www.cnblogs.com/mjtabu/p/12090349.html