TCP has sticky packets, UDP non-sticky packets, will exceed buffer_size data discarded. UDP is only responsible for sending data, regardless of whether the server is open (not dependent on the server), the same operation without error, so unreliable.
TCP stream-oriented, UDP-oriented message packets, each UDP segment is a message. The application must extract data in the message unit and cannot fetch any byte-sized data at a time.
UDP does not need to be connected, so it can provide efficient service.
TCP is based on data flow (do not know the starting position and end position), so send and receive messages can not be empty, you need to add a blank message processing mechanism of C/s, to prevent the card master, and UDP is based on the datagram, even if the input is a space, it is not an empty message, because the UDP protocol encapsulates the message header
Two cases of sticky bag:
1) Packet small: flow-oriented communication is not border protected. TCP will synthesize a data with a small amount of time interval and small data, and transmit it as a package so that the client can only receive one package.
2) Packet large: The receiving side receives the fixed data size less than the packet length from the cache pool, leaving the remaining data in the cache pool, waiting for the second time to receive the data sent by the sending side, resulting in sticky packets.
Python-tcp Sticky Bag