Transport layer: TCP, UDP, QUIC, ports, and sockets are the core concepts of this lesson, which focuses on end-to-end communication between application processes.
The text explains that the transport layer is responsible for providing a logical communication channel between applications by leveraging network layer services. The main transport protocols—TCP, UDP, and QUIC—are then introduced.
TCP offers reliable, connection-oriented communication through mechanisms such as acknowledgments (ACKs), retransmission, flow control, and congestion control. UDP, on the other hand, is a simpler, faster, connectionless, and unreliable protocol, making it suitable for real-time communications such as streaming, VoIP, online gaming, and IoT applications.
The lesson also introduces QUIC, a modern protocol based on UDP but designed to deliver faster, more secure, and more efficient communication, particularly for the modern Web and HTTP/3. Finally, the concepts of ports and sockets are explained; these are essential for directing data to the correct process and managing communication between applications.
Transport layer
The task of the transport layer is to provide services to the application layer above it. To achieve this, it uses the services provided by the underlying Layer 3, the network layer. (Eddy, 2022).
The purpose of the transport layer is to provide an end-to-end logical communication channel for packets. More specifically, it compensates for limitations in data transfer by implementing functions that provide reliability guarantees for the transport itself (Eddy, 2022).
The transport layer is found only in end systems, or hosts, and provides a logical connection between application processes.

Transport protocols
The transport layer provides the application layer with connections that have specific characteristics, particularly through the UDP, TCP, and QUIC protocols (Eddy, 2022; Iyengar & Thomson, 2021; Postel, 1980).
TCP
TCP (Transmission Control Protocol) is one of the main communication protocols used at the transport layer (Eddy, 2022).
TCP provides a reliable, connection-oriented service.
With TCP, a reliable bidirectional logical connection is established between the sender and the receiver.
The main characteristics of TCP include:
To send data through TCP, the protocol divides the message received from the application layer into smaller units called segments. These segments contain (Eddy, 2022):
TCP segments are placed inside IP packets, which are created at the network layer, and transmitted across the network. IP packets may follow different routes before reaching their destination.
Once they reach the destination, the receiver reassembles the segments in sequence order and uses the control information to acknowledge their receipt.
If a packet is not received correctly, TCP requests its retransmission from the sender to ensure data integrity and reliability.
TCP has long been, and still is, widely used on the Internet, especially for services that require reliability, such as file transfers, many web communications, email, and remote access.
A TCP connection goes through at least the following stages:
UDP
Like TCP, UDP (User Datagram Protocol) is a transport-layer protocol, but it provides a very different service (Postel, 1980).
Unlike TCP, which provides reliable, connection-oriented communication, UDP is connectionless and does not guarantee reliable data delivery (Postel, 1980).
This means that when an application uses UDP to send data to another application, the data is simply transmitted without any guarantee that it will be received or delivered correctly.
UDP therefore provides a connectionless and unreliable service.
The main characteristics of UDP are:
Because UDP does not guarantee reliable data delivery, applications using this protocol must handle any data loss or errors themselves at the application layer when necessary (Eggert et al., 2017).
UDP is used when speed and simplicity are more important than reliable data delivery. Some of the main use cases in which UDP is preferred include:
The data unit sent by UDP is called a datagram. A UDP datagram contains a header with essential control information and a payload, which is the data received from the application (Postel, 1980).
QUIC
After examining TCP and UDP, we can introduce a more recent protocol: QUIC (Quick UDP Internet Connections).
QUIC is a modern transport protocol designed to make Internet communications faster, more secure, and more efficient (Iyengar & Thomson, 2021).
It is particularly important because it is used by HTTP/3, one of the most recent versions of the HTTP protocol used on the Web (Bishop, 2022).
An interesting characteristic of QUIC is that it runs over UDP.
This may seem unusual because UDP is a connectionless and unreliable protocol.
However, QUIC uses UDP as its foundation and adds many features normally associated with TCP, including reliability, congestion control, and connection management (Iyengar & Thomson, 2021).
One reason QUIC was developed was to reduce the time required to begin communication. With TCP, a connection must first be established; when HTTPS, meaning HTTP with security, is used, a cryptographic negotiation must also take place.
This can require several steps before the actual data begins to be exchanged.
QUIC instead integrates security directly into the protocol and uses TLS-based mechanisms. This reduces the number of steps required to establish a secure connection. As a result, communication can begin more quickly in many cases (Thomson & Turner, 2021).
Another important characteristic of QUIC is its improved handling of interruptions and network changes. For example, a smartphone may begin browsing over Wi-Fi and then switch to a mobile network.
With a traditional TCP-based connection, this change may interrupt the connection because the network address, or IP address, used by the device changes.
QUIC is designed to handle these changes more effectively and keep communication active whenever possible (Iyengar & Thomson, 2021).
QUIC also improves the management of multiple data streams within the same connection. A modern web page is not made up of a single file: it contains text, images, style sheets, scripts, video, and many other resources. QUIC can manage several streams in parallel, reducing the risk that a delay or loss affecting one part of the data will unnecessarily block the others (Bishop, 2022; Iyengar & Thomson, 2021).
This characteristic is important because some packets may be delayed or lost during network communication. In some traditional systems, the loss of one packet can also delay data that is already available. QUIC attempts to reduce this problem by separating the different communication streams more effectively.
QUIC can therefore be viewed as a protocol that combines some of the positive characteristics of TCP and UDP:
QUIC is well suited to the modern Web, which requires speed, security, and the ability to manage many data streams simultaneously.
QUIC is particularly important because it forms the foundation of HTTP/3, the most recent version of HTTP (Bishop, 2022).
Port
In a networked system, a port is a logical number used to identify a specific communication channel within a host (Cotton et al., 2011).
It is one of the fundamental elements that allows several applications on the same host to use the network simultaneously without interfering with one another.
Imagine the telephone switchboard of a large company.
All the telephones are connected to a single number, representing the actual address. When you call that number, however, you can be connected to different extensions, such as sales, support, or administration. The telephone number is like the computer’s address, while the extensions are like its ports.
To summarize:
Ports allow a host to maintain several different simultaneous communications with other hosts, ensuring that data belonging to a specific service is directed to the process waiting for it (Internet Assigned Numbers Authority [IANA], n.d.).
In TCP- or UDP-based communications, ports are used to associate data with the correct application process (Cotton et al., 2011).
A network communication does not involve only one port: it usually has both a source port and a destination port.
This allows the computer to distinguish several communications that are active at the same time. For example, when a browser opens multiple connections to websites, the operating system can use different source ports to identify each communication.
There are 216=65536 ports, classifiable into three groups (IANA, n.d.):
Example
Consider an example of a well-known port.
When you visit a website such as “www.example.com” in a browser, you implicitly communicate with the server through HTTP (Hypertext Transfer Protocol) on its default port, 80. HTTP is used to request and transfer web pages and other content across the Web.
Consider an example of a registered port.
A company wants to create a web service that adds two numbers.
The service must receive two numbers as input and return their sum as its output.
This calculator program is made available on port 3000.
Every client that wants to use the service must connect to the server’s address and specify port 3000. Its message must contain two numbers, and it must handle a returned number representing their sum. These rules form the protocol.
Consider an example of a dynamic port.
When we open an HTTPS website, the browser connects to port 443 on the web server. The user’s computer also uses its own temporary port, selected automatically by the operating system, to identify that specific communication.
For example, the browser might communicate as follows: client: port 52341 → server: port 443.
If the user opens several tabs or services at the same time, the operating system can assign different dynamic ports to distinguish the various active communications.
Socket
When two devices communicate over a network, knowing their address and port is not enough: a mechanism is also required to manage the actual communication between the two programs.
This mechanism is the socket.
A socket is the software endpoint through which a program communicates over a network (Gilligan et al., 2003).
A socket is the software object that allows a program to send and receive data over a network by using an address and a port:
When an application wants to communicate with another remote application, it creates a socket:
The two applications communicate by exchanging data through their respective sockets.
A local socket is identified by at least an address, a port, and a transport protocol, such as TCP or UDP (Gilligan et al., 2003).
In a TCP connection, the communication is identified more precisely by the combination of the sender’s address and port, the receiver’s address and port, and the protocol being used (Eddy, 2022).
Together, these elements allow a socket to identify a specific connection between two hosts.
The stages of socket communication are:
Sockets are divided into two categories, each characterized by a different communication method.
Example
The following steps occur when a user asks a browser to open www.wikipedia.org:
Consider a very simple socket example.
In this example, the client sends a number to the server. The server calculates its square and returns the result to the client.
The following application-layer client and server code uses transport-layer calls to send the messages.
The transport-layer calls are:
Client Side
Server side
Sotto si vedono le socket rispettivamente del client e del server.
Client Socket
serverAddress = "127.0.0.1" serverPort = 65432 number = 5 socket = CONNECT(serverAddress, serverPort) SEND(socket, number) result = RECEIVE(socket) CLOSE(socket)
Socket Server
serverPort = 65432
LOOP: # when the server completes an operation, it starts listening again
socket = WAIT(serverPort)
dato = RECEIVE(socket)
result = data * data
SEND(socket, result)
CLOSE(socket)







No responses yet