Transport layer protocols provide logical communication between application processes running on different hosts. From an app’s point of view, it may seem like they’re directly connected to other apps, but they may actually be on opposite sides of the globe.

  • This article is a record, basically no personal conclusions, if there is any mistake, please correct, thank you very much.
  • Transportation Layer – Overview – Digging gold (juejin. Cn)

Series of articles:

  • Transportation Layer – Overview – Digging gold (juejin. Cn)
  • 【 Computer Network 】 Transport layer – TCP – Digging gold (juejin. Cn)

Message segment

At the sending end, the transport layer translates the packets received from the sending application process into transport layer groups called transport layer segments. The transport layer passes these segments to the network layer, which encapsulates them into network layer packets (i.e., datagrams) and sends them to the destination.

At the receiving end, the network layer extracts the transport layer packet segment from the datagram and passes the packet segment up to the transport layer. The transport layer processes the received message segments, parses them and presents them to the application.

Multiplexing and multiplex decomposition

The multiplexing and decomposition of transport layer refers to the extension of host-to-host delivery services provided by the network layer to process-to-process delivery services provided by the application provider on the host.

The job of delivering data from a transport layer packet segment to the correct socket is called Demultiplexing. The job of collecting packets from different sockets and generating segments for each packet to encapsulate the transport header and then delivering the segments to the network layer is called Multiplexing.

Multiplexing and multiplexing are necessary for all computer networks. Multiplexing and decomposition enable data delivery from process to process, and data delivery and error checking from process to process are two minimal transport-layer services that UDP can provide, so UDP provides only minimal transport-layer services.

Requirements for multiplexing

  1. A socket has a unique identifier.
  2. Each message segment has a special field indicating the socket to which the message segment is to be delivered.

The unique identifier of a socket is the port number, so the fields in the message segment indicating the socket are the source and destination port numbers.

The port number

The port number is a 16-bit number ranging in size from 0 to 65535. The Port Number that ranges from 0 to 1023 is called the well-known Port Number. Port Numbers in the range 1025 to 65535 are called Dynamic Port Numbers

| | port USES | | : -- -- -- -- - | : -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | | | 21 FTP file transfer service | | | 22 SSH remote connection service | | | 23 TELNET terminal emulation service | | | 25 SMTP simple mail transfer service | | | 53 DNS domain name resolution services | | 80 | HTTP hypertext transfer service | | 443 | | HTTPS encrypted hypertext transfer serviceCopy the code

Connectionless and connection-oriented multiplexing

UDP is a connectionless transport layer protocol. A UDP socket is identified by a binary, which is the destination IP address and destination port number. Therefore, two UDP packets with the same destination IP address and destination port number are directed to the same destination process through the same destination socket, even if the source IP address or source port number is different.

TCP is a connection-oriented transport layer protocol. A TCP socket is identified by a quplet containing the source IP address, source port number, destination IP address, and destination port number. Therefore, as long as any element of the quad is different, it will be directed to a different socket.

Transport layer agreement

The Internet provides applications with two distinct transport-layer protocols, User Datagram Protocol (UDP) and Transmission Control Protocol (TCP).

On the basis of network layer, UDP realizes the minimum requirements of transport layer, that is, multiplexing, multiplexing and error checking. Therefore, IT can be understood that UDP does not provide any features, only the most basic support, the network layer can not solve the problem, in UDP also exist.

Error checking is a must. What’s the use of transmitting data if you can’t guarantee its correctness? Each layer has error checking, even at the network layer, but that only checks the datagram, not the data at the top level, so error checking is a mandatory feature of the transport layer protocol.

TCP provides several additional services, namely full-duplex service, reliable data transmission, and congestion control. Reliable data transmission is process-oriented, allowing TCP to transfer data from the sending process to the receiving process in a correct and orderly manner. Congestion control is Internet oriented so that each connection through a congested network link can share the network link bandwidth equally.

The specific analysis of the two is as follows:

UDP and network layer datagrams

We know that network layer groups are called datagrams, and transport layer groups are called packet segments. But UDP packets are also called datagrams, because the implementation of UDP simply adds the most necessary transport-layer functionality to the network layer, without adding additional functionality. However, there are also some literatures that group the transport layer as datagrams, which is a wrong statement, and it is best not to say so.

If you want to be rigorous or easy to understand, just say transport layer grouping and network layer grouping.