TCP is a connection-oriented transmission protocol. TCP has four features:
1. End-to-End 2. connection-oriented 3. Reliable and ordered data streams 4. batch data transmission now, let's talk one by one. 1. End-to-end. "End" refers to "Port ". The end-to-end protocol is provided by the transport layer. The IP protocol at the network layer at the lower layer of the transport layer transmits data between hosts. IP addresses only mark hosts and do not differentiate processes. The end-to-end protocol is used to determine which process on the host is communicating.
End-to-End protocol Diagram
2. The object-oriented connection uses the TCP protocol. The two processes establish a "connection channel" before transmitting actual data ". The so-called connection channel is neither an end-to-end TDM or OFDM circuit nor a virtual circuit. The TCP protocol only runs in the terminal system and does not run in the intermediate network elements (routers and link layer switches). Therefore, the intermediate elements do not maintain the TCP connection status. The intermediate routers have no knowledge of TCP connections. They only see datagram instead of connection. Next, let's briefly describe the process of establishing a TCP connection. When I first learned how to write a communication program, although I didn't understand the basic principle, the Java program was written as follows: (the client program initiating the communication) Socket client = new Socket (IP, port); IP, it is the IP address of the server, port is the port number of the server process, and port is used to identify the process. At this time, the client's Transport Layer starts to establish a connection with the server's transport layer.
The client application first notifies the client of TCP. It wants to establish a connection with a process on the server (which has been identified by a Port. The TCP of the client establishes a TCP connection with the TCP of the server in the following way: Step 1: The TCP of the client first sends a special TCP packet segment to the TCP of the server. The CIDR block does not contain data at the application layer. It is encapsulated in an IP datagram and sent to the server. Step 2: After the IP datagram arrives at the server, allocate the TCP cache and variable for the TCPP connection (this is not explained yet. Let's talk about the general process first ), and send the allowed packet segment to the client TCP (also does not contain application layer data ). Step 3: after the client receives a Response Message segment from the server, the client also allocates cache and variables for the TCP connection, and the client sends a message segment to the server again to confirm the server's allowed connections. After completing the three steps, the client and server can send packets to each other. This connection method becomes a three-way handshake. In general, this connection ensures that both parties are ready to receive data.
3. reliable. The IP protocol at the network layer of the data stream in order to transmit data is not reliable. data packets may be lost, in disorder, or in errors. Based on the unreliable IP address, TCP establishes a reliable data transmission service. Let's talk about the reliable data transmission service. The implementation of reliable data transmission services naturally relies on reliable data transmission protocols. We need to study a series of protocols, from simple to complex, one by one. 1. Reliable data transmission over fully reliable channels rdt 1.0, that is, the underlying layer is completely reliable. The sender sends data, and the receiver receives the data. No feedback is required between the two because the data is completely reliable. 2. Reliable data transmission over Bits Error channels rdt 2.0 the reality is that the bits in the underlying channel may be damaged, so feedback is required. When the receiver receives the correct data packet, it returns an ACK or incorrect data packet to the NAK. At this time, the Protocol adopts error detection.
3. Based on rdt 2.0, if an error or loss is reported, you must manage the loss feedback. Add seq # Two #'s (2.1) to the group and check ACK/NAK. This is rdt. If there are two packets, error 1, 2, Error 2, and Error 2, but ACK is lost, the transmission process is:
4. The protocol function of rdt 2.2 Without NAK is equivalent to rdt2.1, but only ACK is used instead of NAK. The receiver only sends ACK For The Last correctly accepted packet, the receiver must explicitly indicate the ACK group seq #. The sender obtains the same result of dual ACK, resulting in the NAK: Re-transmits the correct group. For example, the two data packets are correct on the 1st and 2nd, and an error occurs on the 2nd.