Transmission Control Protocol (TCP) is a transport protocol specially designed to provide reliable end-to-end byte streams on unreliable Internet.
The Internet is very different from a single network because different parts of the Internet may have completely different topologies, bandwidths, delays, packet sizes and other parameters. The design goal of TCP is to be able to dynamically adapt to these characteristics of the Internet and be robust in the face of various failures. ?
Extended data:
Reliable and pipe-like connections are often needed between application layers of different hosts, but the IP layer does not provide such a streaming mechanism, but provides unreliable packet switching. ?
The application layer sends the data stream represented by 8-bit bytes to the TCP layer for inter-network transmission, and then TCP divides the data stream into segments of appropriate length (usually limited by the maximum transmission unit (MTU) of the data link layer of the network to which the computer is connected). Then TCP sends the resulting packet to the IP layer, which will send the packet to the TCP layer of the receiving entity through the network.
In order to ensure that packet loss does not occur, TCP gives each packet a sequence number, which also ensures the orderly reception of packets sent to the receiving entity. Then, the receiving entity sends back the corresponding acknowledgement (ack) to the successfully received packet; If the sending entity does not receive the acknowledgement within a reasonable round-trip delay (RTT), the corresponding data packet is considered lost and will be retransmitted. TCP uses checksum function to check whether the data has errors. Checksum should be calculated when sending and receiving.