This paper is participating in theNetwork protocols must be known and must be known”Essay campaign

TCP/IP protocol

TCP and UDP are two of the most famous transport layer protocols and they both use IP as the network layer protocol. TCP is a connection-oriented protocol. Before using TCP to communicate, two applications need to establish a TCP connection

How does TCP do transmission?

TCP is a trusted transmission protocol. Therefore, a three-way handshake is required to establish a connection before transmission. During the establishment of a TCP connection, the client and server send three packets to confirm the reliable establishment of the connection

The TCP layer

TCP/IP has a four-tier protocol system:

The application layer

Telnet (remote login), FTP (file transfer protocol) and E_mail

Transport layer

TCP (Transmission Control Protocol) and UDP (User Data Protocol)

The network layer

IP (Internet Protocol), ICMP (Internet Control Message Protocol), and IGMP (Internet Group Management Protocol)

The link layer

Device drivers and interface cards

Reference: TCP-IP Volume 1: protocol

Each layer communicates with the other by a specific protocol, and the communication between the protocols is eventually converted into binary signals, which can only be communicated through some physical medium

TCP three-way handshake

1. Establish a connection. Segment from which the sender sends a connection request packet (known as the password) 2. Segment from which the receiver receives a connection request packet (known as the password) 3. Sender receives return from receiver (confirmation code)

TCP waved four times

1. The sender sets SEQ and ACK to send a FIN packet to the receiver. 2. The receiving end receives the FIN packet from the sender and returns an ACK packet to the sender. 3. The receiver sends a FIN packet to the sender to close the connection, and the receiver enters the LAST_ACK state.

4. After receiving the FIN packet from the receiver, the sender sends an ACK packet to the receiver. Then the sender enters the TIME_WAIT state. After receiving the ACK packet from the sender, the receiver closes the connection. If the sender waits for 2MSL (the maximum lifetime of a fragment in the network) and still does not receive a reply, the receiver is normally shut down and the sender can disconnect

The android