TCP/IP Detailed learning notes (9)-TCP Protocol Overview

Source: Internet
Author: User
Tags port number

Finally saw the TCP protocol, which is the most important and the most exciting part of the TCP/IP details, to spend great effort to read. In front of TFTP and BOOTP are some simple agreement, do not write notes, write up nothing.

TCP and UDP are in the same layer---transport layer, but TCP and UDP are the most different places, TCP provides a reliable data transmission services, TCP is connection-oriented, that is, the use of TCP communication between the two hosts first to undergo a "call" process, Wait until the communication is ready to start transmitting the data, and finally end the call. So TCP is more reliable than UDP, UDP is to send the data directly, regardless of whether the other party is in the receiving letter, even if the UDP is not delivered, also will not produce ICMP error message, this once reiterated many times.

The simple working principle of TCP reliability is extracted from the following application data is segmented into the data block that TCP thinks is best for sending. This is completely different from UDP, and the length of the datagram generated by the application will remain unchanged. The unit of information that is passed by TCP to IP is called a message segment or segment (segment) (see Figure 1-7). In 1 8.4 We will see how TCP determines the length of the message segment. When TCP sends a segment, it starts a timer and waits for the destination to acknowledge receipt of the message segment. If a confirmation is not received in a timely manner, the message segment will be sent back. In the 21st chapter we will understand the adaptive timeout and retransmission strategy in the TCP protocol. When TCP receives data from the other end of the TCP connection, it sends a confirmation. This confirmation is not sent immediately and will usually be postponed for a fraction of a second, which will be discussed in section 1 9.3. TCP will keep its header and data checked and. This is an end-to-end test and is designed to detect any changes in the data during transmission. If a section is received and there is a mistake, T p discards the segment and does not acknowledge receipt of the message segment (expect the originator to timeout and send it again). Since the TCP message segment is transmitted as an IP datagram, and the arrival of the IP datagram may be out of order, the arrival of the TCP segment may also be out of order. If necessary, TCP will reorder the data received, handing the received data to the application tier in the correct order. TCP can also provide flow control. Each side of the TCP connection has a fixed size buffer space. The receiving end of TCP allows only the other end to send data that is acceptable to the receiving buffer. This will prevent a faster host from causing a buffer overflow on a slower host.

As you can see from this passage, the way to maintain reliability in TCP is to timeout, which makes sense, although TCP can also handle these with a variety of ICMP packets, but this is not reliable, and the surest way is to resend datagrams as long as they are not confirmed. Until we get confirmation from the other side.

Both the TCP header and the UDP header have the send port number and the receive port number. But obviously TCP has more header information than UDP, and the TCP protocol provides all the necessary information to send and verify. This is described in detail in p171-173. It can be imagined that the sending of a TCP data should be a procedure as follows. The two sides establish the connection sender to the recipient TCP datagram, and then wait for the other party to confirm the TCP datagram, if not, resend, if so, send the next datagram. The receiving party waits for the sender's datagram and, if the datagram is verified, sends an ACK (acknowledgement) datagram and waits for the next TCP datagram to arrive. Until you receive the fin (send completion datagram) abort the connection

It is conceivable that, in order to establish a TCP connection, the system may create a new process (worst also a thread) for data transmission

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.