Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lecture 5

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Lecture 5: Transport Layer

Slide: Transport Layer services and protocols

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.

It is more communication between processes.

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).

The services of the transport layer:

 Segmentation and Reassembly


 Error Detection and Correction
 Flow Control
 Multiplexing and Demultiplexing

All the services are provided by TCP protocol.

Slide: Transport vs Network Layer services and protocol

Transport Layer:

Communication between processes on different hosts.

TCP and UDP protocols

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:

Communication between hosts.

The Network Layer is responsible for routing packets of data from the source to the destination
across a network.

It enables end-to-end communication across multiple networks or subnets.

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.

Slide: Transport layer Actions

Action from sender to receiver when transmitting a message from the application layer:

Message Generation (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.

Data Segmentation (Transport Layer):

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.

Error Detection and Addition of Headers (Transport Layer):

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).

Port Assignment (Transport Layer):


The Transport Layer assigns a source port number to the outbound data. This number helps in
identifying which application or service on the sender's device is sending the data. It is also used by
the receiver to determine which application or service should receive the data.

Transmission Control (Transport Layer):

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.

Data Transmission (Network Layer):

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.

Routing and Forwarding (Network Layer):

The Network Layer determines the appropriate path and forwards the packets to reach the
destination, potentially traversing multiple routers or network devices.

Data Transmission over the Network (Data Link Layer):

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).

Receiving at the Receiver (Data Link Layer to Application Layer):

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.

Segment/Datagram Reassembly (Transport Layer):

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.

Error Detection and Correction (Transport Layer):

The Transport Layer performs error checking and, if using TCP, acknowledges the receipt of data
segments to the sender, allowing for retransmission if necessary.

Delivery to Application Layer (Application Layer):

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 (Transmission Control 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.

Here are the key characteristics and features of TCP:

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 (User Datagram Protocol):

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).

Here are the key characteristics and features of UDP:

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.

Slide: How demultiplexing works

The diagram is the transport layer header:


Slide: Connectionless Demultiplexing

If P3 (process) wants to communicate with P1, it needs to input its source and destination port in the
Transport Layer header.

Slide: Connection-oriented Demultiplexing

All that 4 information is used for TCP connection. This information will be transmitted using the
transport layer header.
Slide: UDP – User Datagram Protocol

 Faster than TCP


 It does not provide services like Congestion control, flow control, or error detection.
 UDP is connectionless – No handshake before transmission.
 Packet may lost or delivered out of sequence/order
 Used in games, online classes, streaming football, etc where loss packet is tolerated.
 DNS, SNMP and HTTP/3 uses UDP.
 If you want UDP to be reliable, you can implement services like congestion control, and error
detection at the application layer not at the transport layer. (HTTP/3)

Slide: UDP – User Datagram Protocol [RFC 768]

 RFC 768 is a document specification for UDP.


 The format of UDP header format.
 How UDP works.
 What field it has.

TCP also a document specification for it. (RFC 761)

Slide: UDP – Transport Layer Actions

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

Slide: UDP Checksum

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.

Here's how the UDP checksum works:

Calculation at the Sender:

 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.

Verification at the Receiver:

 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.

The UDP checksum is particularly useful in scenarios where lightweight, low-overhead


communication is needed, and the application can tolerate occasional errors or where the data
integrity is less critical. For example, real-time multimedia streaming or online gaming applications
often use UDP because of its low latency and overhead, and the UDP checksum can help catch some
transmission 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.

Slide: TCP – Overview

Connection-oriented communication – TCP does a handshake before transmitting data

Full duplex data – Can transmit data in both directions.

Flow control and TCP congestion

Reliable communication

Ordered transmission

Slide: TCP Segment Function

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.

Slide: TCP Sequence number, ACKs

Slide: TCP Round Trip, Timeout

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.

You might also like