Computer Network Study Notes: Chapter Three

Computer Network Study Notes: Chapter Three

Study books: "Computer Networks: Top-Down Approach" Chapter 3: Transport Layer

For other chapters, please refer to:
"Computer Network: Top-Down Method" Chapter 1: Computer Network and Internet
"Computer Network: Top-Down Method" Chapter 2: Application Layer
"Computer Network: Top-Down Method" Chapter 2 Chapter Three: Transport Layer



Preface

The transport layer is located between the application layer and the network layer and is an important part of a layered network system; this layer plays a vital role in providing direct communication services for application processes running on different hosts . Here we will discuss two major issues: the expansion of the network layer communication services between different end systems to the communication services between different application layer processes running on the two end systems (how to achieve inter-city communication Reliable transmission) and control the transmission speed of the transport layer entities to avoid network congestion or recover from network congestion. Here are the consequences and causes of congestion and common congestion control methods; in particular, we will understand the TCP protocol Congestion control .

3.1. Overview and transport layer services

The transport layer protocol provides logical communication functions between application processes running on different end systems ; the application layer processes use the logical communication functions provided by the transport layer without considering the details of the physical infrastructure for communication ;

The transport layer protocol is implemented in the end system rather than in the router . Transport layer from the application layer receives the packets and by adding the transport layer header to form a transport layer segment . During the generation process, the messages from the application layer may be segmented ; then in the sending end system, the transport layer will hand these message segments to the network layer; the network layer encapsulates them into network layer packets, also called The datagram is then sent to the destination. The router does not check the fields of the transport layer segment encapsulated in the datagram ; at the receiving end, the network layer extracts the transport layer segment from the datagram and delivers it to the transport layer, and the transport layer receives the segment After that, the data in the segment is used by the receiving application process.

Network applications can use multiple transport layer protocols. The Internet has two transport layer protocols, namely TCP and UDP. Different transport layer protocols provide different transport layer services;

3.1.1 The relationship between the transport layer and the network layer

In the protocol stack, the transport layer is just above the network layer; the network layer provides logical communication between hosts and the transport layer provides logical communication for application processes running on different hosts ; the transport layer protocol only works in the end system . In the end system, the transport layer protocol moves the packets from the application process to the edge of the network, the network layer, and in turn receives these segments from the network layer; the transport layer does not interfere with how the segments are transmitted in the core of the network ; In fact, the intermediate router neither processes nor recognizes any information loaded by the transport layer on the application layer message ;

The services that the transport layer protocol can provide are often restricted by the service type of the underlying network layer protocol. If the network layer protocol cannot provide delay and bandwidth guarantees for communication between hosts , the transport layer protocol cannot provide applications sent between processes. Program messages provide delay or bandwidth guarantee;

However, even if the underlying network protocol cannot provide responsive services at the network layer, the transport layer protocol can also provide certain services. For example, even if the underlying network protocol is unreliable, the transport protocol can provide reliable data transmission services for the application (even if the underlying network protocol is unreliable, causing packet loss and tampering, the transport protocol can also provide reliable data for the application. Data transfer service).

3.1.2 Overview of the Internet Transport Layer

The Internet provides two completely different transport layer protocols for the application layer: UDP (User Datagram Protocol), which provides an unreliable and connectionless service; the other is TCP, which provides a reliable , connection-oriented service; Transport layer grouping is also called segment ;

Take a brief look at the network layer of the Internet. The network layer protocol has a name, IP, or Internet Protocol . IP provides logical communication between hosts, IP service models for the best-effort delivery service (best-effort delivery service) This means that the IP do our utmost to deliver segments between hosts, but without any guarantee. It does not guarantee the delivery of message segments , does not guarantee the delivery of message segments in order , and does not guarantee the integrity of the data in the message segment ; that is, IP provides an unreliable service; each host needs to have a network layer address, That is, the IP address.

UDP and TCP IP primary duty is to provide the inter-host delivery services extended to the service between the two processes on different end systems , which is also known as the transport layer demultiplexing and multiplexing ; UDP and TCP The integrity check is provided by adding an error check field to the transport layer header . Data delivery and error checking from process to process are the two minimum transport layer services, and they are also the only two services that UDP can provide. Like IP, UDP is also an unreliable service;

TCP provides additional services. First of all, it is a reliable data service , which means that the TCP protocol guarantees that the data is sent from the sending end application process to the receiving end application process in an orderly and complete manner; TCP uses flow control, sequence number, confirmation and timing It converts the unreliable data transmission of IP into reliable data transmission; secondly, TCP provides congestion control . Congestion control is not so much a service provided to applications, as it is a service provided to the entire network, because the entire network The network will benefit from congestion control; to be less strict, congestion control strives to provide equal shared network link bandwidth for each connection passing through a congested network, thereby avoiding a TCP connection from flooding the communication host with excessive traffic and the link between the devices; congestion control of TCP is done by adjusting the obtained transmitted into the network traffic rate ; UDP does not provide congestion control, applications using UDP transmissions may be needed at any rate to transmit data.

3.2, multiplexing and demultiplexing

As mentioned earlier, the transport layer expands the host-oriented logical communication provided by the network layer into logical communication for different application processes, and this process is called multiplexing and demultiplexing; multiplexing and demultiplexing are Every computer network needs;

At the destination host, the transport layer receives message segments from the network layer immediately below it; the transport layer is responsible for delivering the data in these message segments to the application process running on the host; Section 2.7 mentioned that a process has one or a plurality of sockets , and data corresponding to the data transmitted from the portal process is transmitted to the network from the network to process; transfer between the transport layer and the application process associated with the socket by receiving the transport layer host is not actually directly The data is delivered to the process, but the data is delivered to a socket in the middle; at any one time, there may be more than one socket on the receiving host , and each socket has a unique identifier ;

The process of the transport layer receiving data from different sockets on the same host is called multiplexing ; the process of transmitting data from the transport layer to different sockets on the same host is called demultiplexing ; in order to achieve multiplexing and multiplexing To decompose, we need to mark the socket and add relevant information to the message segment.

Transport layer multiplexing requirements : 1) The socket has a unique identifier; 2) Each message segment has a source port number field and a destination port number field to indicate the socket to which the message segment will be delivered;
The size of the port number is between 0-65535, of which 0-1023 is a well-known port number, which is owned by a specific socket.
How the transport layer realizes the decomposition service : each socket on the host can be assigned a port number; when the message reaches the host, the transport layer checks the destination port number of the message segment and directs it to the corresponding socket, and then the message The data in the segment enters the connected process through the socket; UDP roughly does this, and TCP is more complicated;

Connectionless multiplexing and demultiplexing

It should be noted that when creating a Socket, the transport layer allocates a port number for it; a UDP socket is marked by a destination IP address and a destination port number (ie a two-tuple); if two UDP Message segments have different source IP addresses or source port numbers, but if they have the same destination IP and destination port numbers, they will reach the same application through the same Socket;

The purpose of the source port number : For example, in the segment from A to B, the source port number is used as part of the "return address", that is, when B wants to send a segment back to A, the destination in the segment from B to A The port number is taken from the source port number in the message segment from A to B (the complete return address also includes A's IP address);

Connection-oriented multiplexing and demultiplexing

Socket in the TCP protocol is marked by a four-tuple : ( source IP address, source port number, destination IP address, destination port number ); two have different source IP addresses or source port numbers, but have the same purpose The TCP segment of the IP address and destination port number will enter the same application process through two different Sockets; this also means that an application process can be associated with multiple Sockets, and a Socket will only be associated with one application process ; often, such Correspondence is achieved through threads: a process has multiple threads, and each thread is associated with a Socket; this can improve server performance;

In fact, the transport layer is based on this information to achieve demultiplexing; and this information is placed in the message segment during multiplexing;

Guess you like

Origin blog.csdn.net/Dr3stark/article/details/109768268