Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream transport layer communication protocol specified in IETF RFC 793. In a simplified computer network OSI model, it performs the functions specified at the transport layer (layer 4). UDP is another important transport protocol at the same layer.
In the Internet protocol suite, the TCP layer is positioned above the IP layer and below the application layer. Applications between different hosts often require reliable, pipe-like connections, but the IP layer does not provide such stream mechanisms, instead offering unreliable packet switching.
The application layer sends a data stream represented in 8-bit bytes to the TCP layer, which segments the data stream into appropriately sized packets (usually limited by the Maximum Transmission Unit (MTU) of the data link layer of the network to which the computer is connected). TCP then hands the resulting packets to the IP layer to send over the network to the receiving TCP layer. To ensure that no packets are lost, TCP assigns a sequence number to each byte, which also ensures that packets are received in order at the receiving entity. The receiving entity sends back an acknowledgment (ACK) for the successfully received bytes; if the sending entity does not receive an acknowledgment within a reasonable Round Trip Time (RTT), the corresponding data (assumed lost) will be retransmitted. TCP uses a checksum function to check for errors in the data; checksums are calculated both when sending and receiving.
A TCP connection includes three states: connection establishment, data transfer, and connection termination.
蘊藏許多助人的知識與智慧。