Introduction to Transport Layer Protocol and Three Handshake and Four Waves

Header transport layer protocol

TCP protocol
UDP protocol

TCP and UDP are the two most famous transport layer protocols, both of which use IP as the network layer protocol

Although both TCP and UDP use the same network layer (IP), TCP provides completely different services to the application layer than UDP. TCP provides a connection-oriented, reliable byte stream service.

TCP: Transmission Control Protocol, a connection-oriented protocol

Connection-oriented means that two applications that use TCP (usually a client and a server) must establish a TCP connection before exchanging data with each other.

One-to-one transmission

tcp three-way handshake

Insert picture description here

TCP disconnected four times

Insert picture description here

TCP header

Insert picture description here

UDP protocol

UDP: User Datagram Protocol, a connectionless transport layer protocol in the OSI reference model, provides simple and unreliable transaction-oriented information transmission services, UDP provides connectionless communication, suitable for transmitting a small amount of data at a time, UDP packets There is no reliability guarantee, sequence guarantee and flow control fields, etc., and the reliability is poor. However, because the UDP protocol has fewer control options, the delay in data transmission is small, and the data transmission efficiency is high. It is suitable for applications that do not require high reliability, or applications that can guarantee reliability, such as DNS, TFTP, and SNMP Wait.

One-to-one, one-to-many transmission, many-to-one and many-to-many interactive communication are possible
Insert picture description here

The difference between TCP and UDP:

1. TCP connection-oriented (such as dialing to establish a connection before making a call); UDP is connectionless, that is, there is no need to establish a connection before sending data

2. TCP provides reliable services. That is to say, the data transmitted through the TCP connection has no errors, no loss, no duplication, and arrives in order; UDP does its best to deliver, that is, it does not guarantee reliable delivery. Tcp uses checksum, retransmission control, and sequence number identification, Sliding window and confirmation response realize reliable transmission. For example, the retransmission control when the packet is lost, the sequence control of the out-of-sequence sub-packets can also be performed.

3. UDP has better real-time performance, higher working efficiency than TCP, and is suitable for high-speed transmission and real-time communication or broadcast communication.

4. Each TCP connection can only be point-to-point; UDP supports one-to-one, one-to-many, many-to-one and many-to-many interactive communications

5. TCP requires more system resources, while UDP requires less system resources.

Guess you like

Origin blog.csdn.net/weixin_44324367/article/details/109279102