TCP provides a connection-oriented, reliable byte-stream service;
What is a byte stream service :
TCP does not insert a record marker in a byte stream is called a byte stream service;
How TCP handles byte streams :
TCP does not explain the content of the byte stream, because TCP can not tell what type of data is transmitted, and the interpretation of the byte stream is explained by the application layer of the TCP connection;
TCP's processing of this byte stream is similar to the way the UNIX operating system handles files;
The Unix operating system handles files in such a way that the Unix kernel does not interpret the contents of an application's read or write, but instead gives it to the application to interpret it because the Unix kernel cannot differentiate between binary and text files
In a TCP connection, only two parties communicate;
Definition of message segment :
The unit of information that is passed to IP by TCP is called a message segment or segment;
The following is How TCP provides reliability :
(1) The application data is partitioned into the most appropriate data block that TCP considers to be sent;
(2) When TCP sends a segment, it starts a timer, Used to wait for the destination to acknowledge receipt of this segment; If this acknowledgement is not received in time, the TCP sender will resend the message segment (timeout retransmission);
(3) TCP sends a confirmation after receiving a data from the other end of the TCP connection, but this acknowledgement is not sent immediately. Instead, it is deferred for a fraction of a second before it is sent;
(4) TCP will keep its header and data checked and (this is an end-to-end test and, in order to verify the errors that occur during the transmission of the data), if the inspection and error of the segment are detected, TCP will discard and not acknowledge receipt of this segment and hope that the originator can make a timeout retransmission)
(5) because the TCP segment is transmitted as an IP datagram, and because the arrival of the IP datagram may be out of order, the arrival of the TCP message segment may also be out of sequence; If necessary, TCP will re-order the received data to the application layer,
(6) because the TCP segment is transmitted as an IP datagram, and the IP datagram may be duplicated, so the TCP receiver must discard the duplicate data;
(7) TCP provides traffic control (Because each side of the TCP connection has a fixed-size buffer space, the TCP receiver only allows the other end to send the data that the receive-side buffers can accept, which prevents a faster host from causing a slower host buffer overflow)