Transport Layer
- The network layer is responsible for host-to-host communication at the computer level, delivering
messages only to the destination computer.
- However, this delivery is incomplete, as the message still needs to be directed to the specific
computer process. Therefore, the primary role of the transport layer is to provide communication
services directly to the application processes running on different hosts.
- The transport layer establishes a logical communication channel between application processes on
different hosts. Despite not being physically connected, application processes utilize the logical
communication facilitated by the transport layer to exchange messages.
- For instance, when using WhatsApp on a mobile phone, the connection between two phones is
established by the network layer, but the communication between my WhatsApp application and my
friend's WhatsApp application is facilitated by the transport layer.
- The transport layer protocol is specifically responsible for delivering messages to the appropriate
process. It ensures end-to-end or process-to-process communication, addressing the intricacies
(complexities) of
connecting and communicating between specific applications running on different hosts.
-
Common transport layer protocols include Transmission Control Protocol (TCP) and User
Datagram Protocol (UDP), each offering different features and trade-offs in terms of
reliability and speed.
- Transport layer protocols use port numbers to identify specific processes on a host,
enabling the correct delivery of messages to the intended applications.
- Through flow control and error detection mechanisms, the transport layer ensures reliable
and ordered delivery of messages between applications.
- Transport layer services contribute to the abstraction of the underlying network
complexities, allowing application developers to focus on high-level communication without
worrying about the complexities of network configuration.
Connection-Oriented and Connectionless Services in Transport Layer
-
Connection-Oriented Services:
- Connection-oriented services in the transport layer involve the establishment of a
dedicated, reliable, and ordered communication channel before data exchange begins.
- These services ensure a virtual circuit or connection is established between the sender
and receiver, providing a reliable and predictable data transfer mechanism.
- Transmission Control Protocol (TCP) is a prime example of a connection-oriented
protocol, offering features such as acknowledgment, flow control, and error checking to
ensure the integrity of data delivery.
- Connection-oriented services are suitable for applications where data accuracy,
sequencing, and completeness are critical, such as file transfer and web browsing.
-
Connectionless Services:
- Connectionless services in the transport layer involve communication without the
establishment of a dedicated connection beforehand.
- These services are faster and less resource-intensive but do not guarantee ordered or
error-checked delivery of data.
- User Datagram Protocol (UDP) is a classic example of a connectionless protocol,
providing a lightweight and quick data transfer mechanism without the overhead of
connection setup and maintenance.
- Connectionless services are suitable for real-time applications, such as online gaming,
live streaming, and voice over IP (VoIP), where speed is prioritized over guaranteed
data delivery.
Transmission Control Protocol (TCP) vs. User Datagram Protocol (UDP)
-
Transmission Control Protocol (TCP):
- TCP is a connection-oriented protocol that provides reliable, ordered, and error-checked
delivery of data between applications.
- It establishes a virtual circuit or connection between the sender and receiver before
exchanging data, ensuring that data is delivered accurately and in the correct order.
- TCP includes features such as flow control, acknowledgment of received data, and
retransmission of lost or corrupted packets to guarantee the integrity of the
communication.
- Example: Web browsing, file transfer (e.g., FTP), and email (e.g., SMTP) commonly use
TCP to ensure accurate and complete data delivery.
-
User Datagram Protocol (UDP):
- UDP is a connectionless protocol that provides faster, simpler, and less reliable
communication compared to TCP.
- It does not establish a dedicated connection before data transfer, and it does not
perform error checking or retransmission of lost packets.
- UDP is suitable for applications where speed and low overhead are prioritized over
guaranteed data delivery, such as real-time applications like online gaming, live
streaming, and voice over IP (VoIP).
- Example: Domain Name System (DNS) uses UDP for quick and lightweight communication to
resolve domain names to IP addresses.
-
Comparison:
- TCP is ideal for applications that require reliable, ordered, and error-checked
delivery, making it suitable for scenarios where data accuracy is crucial.
- UDP, on the other hand, is suitable for applications where speed and simplicity are
prioritized, and occasional packet loss or disorder is acceptable.
- The choice between TCP and UDP depends on the specific requirements of the application
and the trade-offs between reliability and speed.
Services provided by the Transport Layer
- The services offered by the transport layer share similarities with those of the data link
layer. While the data link layer operates within a single network, the transport layer extends
its services across an internetwork, encompassing multiple interconnected networks. Unlike the
data link layer, which governs the physical layer, the transport layer exercises control over
all the lower layers of the OSI model.
The services provided by transport layer protocols can be categorized into five main areas:
- End-to-End Delivery: Ensuring the reliable delivery of messages between the
source and destination, regardless of the number of intermediate networks.
- Addressing: Managing the addressing scheme to identify the source and
destination processes in the communication.
-
Reliable Delivery: Ensuring the accuracy and completeness of data delivery
through:
- Error Control: Detecting and correcting errors in transmitted data.
- Sequence Control: Maintaining the correct order of data packets during transmission.
- Loss Control: Minimizing data loss during the transmission process.
- Duplication Control: Preventing the occurrence of duplicated data packets.
- Flow Control: Managing the rate of data transmission to prevent overwhelming
the receiving device or network.
-
Multiplexing: Efficiently handling multiple communication streams through:
- Upward Multiplexing: Combining data streams from multiple processes into a single
communication channel.
- Downward Multiplexing: Distributing data streams from a single source process to
multiple destination processes.
User Datagram Protocol (UDP)
- User Datagram Protocol (UDP) operates at the Transport Layer and is an integral part of the
Internet Protocol suite, commonly known as UDP/IP suite.
- Unlike Transmission Control Protocol (TCP), UDP is characterized as an unreliable and
connectionless protocol. Consequently, there is no need to establish a dedicated connection
before initiating data transfer.
- While TCP is the predominant transport layer protocol for most Internet services, providing
guaranteed delivery, reliability, and additional features, these benefits come with added
overhead and latency.
- UDP, on the other hand, plays a crucial role in scenarios that demand real-time services, such
as online gaming, voice or video communication, and live conferences. In these applications,
where high performance is paramount, UDP allows packets to be dropped instead of processing
delayed packets. Notably, UDP lacks error checking, resulting in bandwidth savings.
- User Datagram Protocol (UDP) stands out for its efficiency in terms of both latency and
bandwidth, making it a preferred choice for time-sensitive and performance-critical
applications.
UDP Header
- The UDP header is a fixed and simple 8-byte structure, in contrast to TCP, which can vary in
size from 20 to 60 bytes.
- The first 8 bytes of the UDP header contain all the necessary information, while the
remaining part is dedicated to data transmission.
- UDP port number fields are each 16 bits long, allowing for a port number range defined from
0 to 65535. Port number 0 is reserved for special purposes. These port numbers play a
crucial role in distinguishing between different user requests or processes.
- The UDP header consists of the following fields, each serving a specific purpose:
- Source Port: Identifies the port of the sender, helping in the
proper routing of the response.
- Destination Port: Specifies the port of the intended recipient,
guiding the delivery of the data.
- Length: Indicates the total length of the UDP datagram, including
both the header and the data.
- Checksum: Facilitates error detection, ensuring the integrity of
the transmitted data.
Applications of UDP:
- Used for simple request-response communication when the data size is small, reducing
concerns about flow and error control.
- Suitable for multicasting due to its support for packet switching.
- Utilized in routing update protocols like RIP (Routing Information Protocol).
- Preferred for real-time applications that cannot tolerate uneven delays in message sections.
- Implementations using UDP as a transport layer protocol include:
- NTP (Network Time Protocol)
- DNS (Domain Name Service)
- BOOTP, DHCP
- NNP (Network News Protocol)
- Quote of the day protocol
- TFTP, RTSP, RIP
- Tasks performed by the application layer through UDP:
- Trace Route
- Record Route
- Timestamp
- UDP takes a datagram from the Network Layer, attaches its header, and swiftly sends it to
the user, contributing to its fast operation.
- UDP is considered a null protocol if you remove the checksum field, reducing the demand on
computer resources.
- Effective when using Multicast or Broadcast for data transfer.
- Commonly employed for the transmission of real-time packets, particularly in multimedia
applications.