TCP reliable transmission mechanism

Source: Internet
Author: User
TCP provides a connection-oriented and reliable byte stream service. Connection orientation means that two TCP applications (usually one customer and one server) must establish a TCP connection before exchanging data packets with each other. This process is similar to making a phone call. Call the phone and wait for the other party to say "hello. In a TCP connection, only two parties communicate with each other. Broadcast and multicast cannot be used for TCP. TCP provides reliability through the following methods: 1. byte-oriented stream and cache mechanism: Application Data is divided into data blocks that TCP considers to be the most suitable for sending. This is completely different from UDP, and the Data Length generated by the application will remain unchanged. The unit of information transmitted to an IP address by TCP is called a segment or segment ). 2. Timeout retransmission and confirmation mechanism: when TCP sends a segment, it starts a timer and waits for the target end to confirm receipt of the segment. If a confirmation message cannot be received in time, the message segment will be resold. When TCP receives data from the other end of the TCP connection, it sends a confirmation message. TCP has the delay confirmation function. If this function is not enabled, it is confirmed immediately. When the function is enabled, the timer triggers the confirmation time. 3. Check Mechanism: TCP will maintain the test of its header and data. This is an end-to-end test to detect any changes in data during transmission. If the packet is verified and has errors, TCP discards the packet segment and does not confirm that the packet segment is received (it is expected that the initiator times out and resends the packet segment ). 4. byte numbering mechanism: Since the TCP packet segment is transmitted as an IP datagram, the arrival of the IP datagram may be out of order, so the arrival of the TCP packet segment may also be out of order. If necessary, TCP sorts the received data again and delivers the received data to the application layer in the correct order. 5. Automatic discard duplication mechanism: Since the IP datagram will repeat, the TCP receiver must discard repeated data. 6. Traffic Control: TCP also provides traffic control. Each side of a TCP connection has a fixed buffer space. The TCP receiving end only allows the other end to send data that can be accepted by the receiving end buffer. This will prevent the buffer overflow of the slow host caused by the fast host. The two applications exchange byte streams consisting of 8-bit bytes over TCP connections. TCP does not insert record identifiers in byte streams. We call this bytestreamservice ). If the application of one party first transmits 10 bytes, then 20 bytes, and then 50 bytes, the other party connected will not be able to know how many bytes each time the sender sends. As long as your receiving cache is not full, the TCP receiver will receive as much as it is. One end migrates bytes to the TCP connection, and the same byte stream will appear on the other end of the TCP connection. In addition, TCP does not explain the content of the byte stream. TCP does not know whether the transmitted data byte streams are binary data, ASC ⅱ characters, ebcdic characters, or other types of data. The interpretation of byte streams is explained at the application layer of both TCP connections.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.