Lecture 5
Lecture 5
Lecture 5
The Transport Layer is the fourth layer in the OSI (Open Systems Interconnection) model and the
TCP/IP protocol suite.
Its primary purpose is to provide end-to-end communication services and ensure the reliable and
efficient transfer of data between two devices on a network.
The Transport Layer divides large messages into smaller segments before transmission and
reassembles them at the destination.
Transport Protocols: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP).
Transport Layer:
Error Detections - provides mechanisms for error detection and correction, ensuring data integrity.
Reassembly of packets - The Transport Layer segments and reassembles data to break large
messages into smaller packets for transmission and then reassemble them at the destination.
Flow control - regulate the rate of data transmission to prevent congestion and ensure efficient data
transfer.
Network Layer:
The Network Layer is responsible for routing packets of data from the source to the destination
across a network.
Internet protocol (IP) is the primary protocol at the Network Layer. IPv4 and IPv6 are the most
common versions. IP is responsible for addressing and routing packets, determining the best path to
reach the destination, and forwarding packets between routers.
Packet forwarding, Subnetting and addressing are all done in this layer.
Action from sender to receiver when transmitting a message from the application layer:
The process begins at the Application Layer, where an application or software generates a message
or data to be transmitted. This message can be, for example, an email, a web page request, a file to
download, or any other form of application-specific data.
The message generated by the application layer might be too large for efficient transmission. The
Transport Layer may break down the message into smaller units called segments (if using TCP) or
datagrams (if using UDP). These segments/datagrams are of a suitable size for transmission over the
network.
The Transport Layer adds header information to each segment/datagram. This header includes
details like the source and destination port numbers, sequence numbers (in the case of TCP), and
error-checking information (e.g., checksum).
If using TCP, the sender initiates the establishment of a connection with the receiver through a
three-way handshake. This includes the negotiation of initial sequence numbers and connection
parameters.
The data, now in the form of segments or datagrams, is handed over to the Network Layer, which is
responsible for addressing and routing the data. The data is encapsulated into packets at this layer.
The Network Layer determines the appropriate path and forwards the packets to reach the
destination, potentially traversing multiple routers or network devices.
At the Data Link Layer, the packets are further encapsulated into frames suitable for transmission
over the physical network medium. The frames are transmitted over the network using the
appropriate link-layer protocols (e.g., Ethernet, Wi-Fi).
The frames are received by the receiver's Data Link Layer, which strips off the framing and passes the
packets to the Network Layer. The Network Layer processes the packets, and if necessary, forwards
them to higher layers of the protocol stack.
If using TCP, the Transport Layer at the receiver reassembles the received segments into the original
message. This process ensures that the data is in the correct order for the application.
The Transport Layer performs error checking and, if using TCP, acknowledges the receipt of data
segments to the sender, allowing for retransmission if necessary.
Finally, the data is passed up to the Application Layer on the receiver's end, where the receiving
application processes the message or data. For example, a web browser would render a web page,
or an email client would display an email.
Slide: Two Principal Internet Transport Protocol
TCP provides a reliable, connection-oriented, and error-checked communication service for data
transmission over a network. It uses the three-way-handshake model to establish connection.
Connection-Oriented: TCP establishes a connection between the sender and receiver before data
transfer begins. This connection is created using a three-way handshake process.
Reliable Data Delivery: It acknowledges the receipt of data segments and retransmits lost or
corrupted segments to guarantee data integrity.
Ordered Data Transmission: TCP maintains the order of data segments. Data is sent and received in
the same order, which is crucial for applications that rely on data sequencing, like web pages, email,
and file transfer.
Flow Control: TCP uses flow control mechanisms to regulate the data transfer rate and prevent
network congestion. It adjusts the sending rate based on acknowledgments received from the
receiver, ensuring the receiver is not overwhelmed.
Error Detection and Correction: If a segment is found to be damaged or lost during transmission,
TCP retransmits it to guarantee data integrity.
Full-Duplex Communication: This means that data can be sent and received simultaneously in both
directions. This is crucial for applications requiring two-way communication.
UDP is an internet protocol that is unreliable as it does not establish a connection before
transmitting data.
UDP is a lightweight, fast, and connectionless protocol used for applications that prioritize speed and
responsiveness over data reliability. It is suitable for real-time and multimedia applications where
low latency is essential, and minor data loss can be tolerated (Games, Online classes).
Connectionless: This means it does not establish a connection before transmitting data. It simply
sends data to the recipient without any handshaking process.
Unreliable Data Delivery: It does not acknowledge the receipt of data, so data may be lost,
duplicated, or arrive out of order.
No Flow Control: It does not adjust the sending rate based on the receiver's capacity, which can lead
to potential network congestion.
Low Overhead: It does not include additional mechanisms for reliability, sequencing, or error
correction, making it faster for real-time applications where low latency is crucial.
Minimalist Approach: UDP follows a minimalist approach, making it suitable for applications that
prioritize speed and simplicity over reliability.
No Error Detection or Correction: If data packets are lost or corrupted during transmission, there
are no automatic mechanisms for recovery.
Real-Time Applications: UDP is commonly used in real-time applications that require low latency
and high-speed data transmission, such as online gaming, Voice over IP (VoIP), streaming media, and
live video conferencing.
Broadcast and Multicast Support: UDP supports broadcasting and multicasting, allowing a single
packet to be sent to multiple recipients simultaneously.
Slide: Multiplexing/Demultiplexing
Multiplexing is the process of combining multiple data streams or signals into a single composite
signal for transmission over a shared medium or network connection. It allows multiple sources of
data to share the same communication channel efficiently.
Purpose: Multiplexing is used to maximize the utilization of network resources, enabling multiple
applications or devices to send their data simultaneously over a single network connection. This
process helps reduce network congestion and efficiently use available bandwidth.
Use the transport header (to be use when Demultiplexing) to know which application (The
destination) needs to receive the data
Demultiplexing is the process of separating the combined or multiplexed data back into its
constituent streams at the receiving end. It identifies the source or destination for each part of the
combined data and routes it to the appropriate recipient.
Purpose: Demultiplexing is essential to ensure that data sent from different sources can be correctly
delivered to their intended destinations. It involves examining the identifiers or labels applied during
the multiplexing process to determine where each part of the data should be sent.
If P3 (process) wants to communicate with P1, it needs to input its source and destination port in the
Transport Layer header.
All that 4 information is used for TCP connection. This information will be transmitted using the
transport layer header.
Slide: UDP – User Datagram Protocol
SNMP, or Simple Network Management Protocol, is an application layer protocol used for managing
and monitoring network devices, such as routers, switches, servers, printers, and other hardware
devices. SNMP allows network administrators to collect information about the status and
performance of these devices, configure them remotely, and receive notifications about important
events.
Slide: UDP Segment Header
The UDP (User Datagram Protocol) checksum is a simple form of error-checking mechanism used in
UDP to ensure the integrity of data as it's transmitted between devices over a network. While UDP is
a connectionless, unreliable protocol, the checksum helps detect errors in the UDP data to a certain
extent.
When a device sends a UDP datagram, it calculates a checksum value for the UDP header
and the UDP data.
The checksum is computed as a 16-bit one's complement sum of the UDP header and data.
This means that all 16-bit values are added together, and any overflow (carry) from the most
significant bit is added to the least significant bit.
The sender then places this checksum value in the UDP header of the datagram.
When the receiver receives the UDP datagram, it calculates the checksum in the same way,
using the UDP header and data from the received datagram.
If the calculated checksum matches the checksum value in the UDP header, the data is
considered valid and is processed.
If the calculated checksum does not match the value in the UDP header, the datagram is
considered corrupt, and it is typically discarded.
The UDP checksum is not as robust as the error-checking mechanisms used in the TCP (Transmission
Control Protocol) because it only provides a basic level of error detection. It can detect errors in the
UDP header and data, but it cannot correct these errors, and it may not be able to detect all types of
errors.
However, for applications that require guaranteed data delivery and more robust error handling, TCP
is a better choice due to its reliable, connection-oriented nature and more advanced error-checking
mechanisms, such as sequence numbers and acknowledgment mechanisms.
Reliable communication
Ordered transmission
TCP tries to increase speed based on network conditions. For example, at first, it will send one
packet and then 2. If it tries to send 3 and one fails or is lost, it will send 2 only next time and will try
again later.
If packet sequence 6 is lost but the receiver has received 4, 5 and 7. The receiver will ask the TCP to
send again starting from sequence 5.
The Round-Trip Time is the time it takes for a packet (segment) to be sent from the sender, travel to
the receiver, and then for an acknowledgment of that packet to return to the sender. RTT is a
fundamental parameter that TCP uses to estimate network conditions. It is typically measured in
milliseconds.
The timeout, also known as the retransmission timeout (RTO), is the amount of time that TCP waits
for an acknowledgment before it retransmits a packet. If an acknowledgment is not received within
this timeout period, TCP assumes the original packet was lost or delayed and retransmits it. The
timeout value is calculated dynamically based on the RTT measurements and is adjusted over time.