What is TCP protocol and what is the role of TCP protocol?

What is TCP protocol

Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte stream-based transport layer communication protocol, defined by IETF's RFC 793 [1]
:

TCP is designed to accommodate a layered protocol hierarchy that supports multiple network applications. TCP is relied upon to provide reliable communication services between pairs of processes in a host computer connected to different but interconnected computer communication networks. TCP assumes that it can obtain simple, possibly unreliable datagram services from lower-level protocols. In principle, TCP should be able to operate on top of a variety of communications systems, from hardwired connections to packet-switched or circuit-switched networks

TCP congestion control

In terms of congestion control, the widely acclaimed TCP congestion control algorithm (also known as AIMD algorithm

slow start

Whenever a TCP connection is established or a TCP connection times out and is retransmitted, the connection enters the slow start phase.

congestion avoidance

In the slow start phase, when the cwnd value exceeds the slow start threshold (ssthresh), the slow start process ends and the TCP connection enters the congestion avoidance phase. In the congestion avoidance phase, the cwnd value is incremented by 1 after each cwnd message segment sent is fully acknowledged. At this stage, the cwnd value increases linearly.

Fast retransmission

Fast retransmission is an improvement over timeout retransmission. When the source receives three duplicate acknowledgments for the same message, it determines that a message segment has been lost, and therefore retransmits the lost message segment immediately without waiting for the retransmission timer (RTO) to expire. This reduces unnecessary waiting time.

Quick recovery

Quick recovery is an improvement over the loss recovery mechanism. After fast retransmission, it directly enters the congestion avoidance phase without going through the slow start process. Each time after fast retransmission, set ssthresh=cwnd/2, cwnd=ssthresh+3. After that, every time a duplicate confirmation is received, the cwnd value is increased by 1 until the cumulative confirmation of the lost message segment and several subsequent message segments is received, and cwnd=ssthresh is set to enter the congestion avoidance phase.

main feature

TCP is a communication protocol for wide area networks. Its purpose is to provide a communication method between two communication endpoints with the following characteristics when communicating across multiple networks:

  • (1) Stream-based approach;
  • (2) Connection-oriented;
  • (3) Reliable communication method;
  • (4) When the network condition is not good, try to reduce the bandwidth overhead caused by retransmission of the system;
  • (5) Communication connection maintenance is oriented to the two endpoints of communication, regardless of intermediate network segments and nodes.

In order to meet these characteristics of the TCP protocol, the TCP protocol makes the following provisions: [10]

①Data fragmentation: User data is fragmented at the sending end and reassembled at the receiving end. TCP determines the size of the fragments and controls fragmentation and reassembly;

② Arrival confirmation: When the receiving end receives the fragmented data, it sends a confirmation to the sending end based on the fragmented data sequence number;

③ Timeout retransmission: The sender starts the timeout timer when sending fragments. If the corresponding confirmation is not received after the timer times out, the fragment will be resent;

④ Sliding window: The size of the receiving buffer space of each party in the TCP connection is fixed. The receiving end only allows the other end to send the data that the receiving end buffer can accommodate. TCP provides flow control on the basis of the sliding window to prevent faster hosts from causing faster Buffer overflow on slow host;

⑤Out-of-sequence processing: TCP fragments transmitted as IP datagrams may arrive out of order. TCP will reorder the received data and deliver the received data to the application layer in the correct order;

⑥Duplicate processing: TCP fragments transmitted as IP datagrams will be repeated, and the TCP receiving end must discard the duplicate data;

⑦Data checksum: TCP will maintain the checksum of its header and data. This is an end-to-end checksum to detect any changes in the data during transmission. If the checksum of a received fragment is incorrect, TCP will discard the fragment and not acknowledge receipt of the segment, causing the peer to timeout and resend.

Guess you like

Origin blog.csdn.net/sweetser/article/details/135068153