Introduction to Transport Layer
Introduction to Transport Layer is the fourth layer in the OSI model responsible for delivering data between devices across a network reliably and efficiently. It breaks down large data from the application layer into smaller segments, manages the flow of data to prevent congestion, and ensures error-free transmission through error detection and correction mechanisms.
This layer provides end-to-end communication and manages connections between devices using protocols like TCP (connection-oriented) and UDP (connectionless). It also uses port numbers to direct data to specific applications or services on a device. Overall, the Transport Layer ensures data is delivered accurately, in order, and without loss. (Introduction to Transport Layer)
Connectionless Service
Connectionless service is a method of data communication where each data packet is sent independently without establishing a dedicated communication path between sender and receiver beforehand. In this service, the network treats each packet as a separate entity with its own destination address.
Characteristics:
- No Connection Establishment: There is no handshake or setup phase before data transmission.
- Independent Packets: Each packet (datagram) is routed independently and may take different paths to the destination.
- No Guaranteed Delivery: Packets can be lost, duplicated, or arrive out of order since the network does not track the packets.
- Lower Overhead: Because it avoids the process of connection setup and maintenance, it uses fewer resources and less bandwidth.
- No Acknowledgement: The sender does not wait for an acknowledgment from the receiver after sending data. (Introduction to Transport Layer)
- Suitable for Time-Sensitive Applications: It is ideal for applications where speed is crucial and occasional data loss is acceptable, like video streaming, voice calls (VoIP), or online gaming.
Examples:
- User Datagram Protocol (UDP): The most common transport-layer protocol that provides connectionless service.
- Internet Protocol (IP): Works connectionlessly at the network layer.
Advantages:
- Faster transmission due to minimal protocol overhead.
- Simpler implementation. (Introduction to Transport Layer)
- Efficient for broadcasting and multicasting.
Disadvantages:
- No reliability guarantees.
- Packets can arrive out of order.
- Not suitable for applications that require guaranteed delivery.
Connection-Oriented Service
Connection-oriented service requires that a communication session or connection is established between the sender and receiver before any data is transmitted. This setup phase involves a handshake process to agree on parameters and confirm that both parties are ready to communicate. During the connection, data is sent as a continuous stream, and the service ensures the proper delivery of data. Once communication ends, the connection is terminated formally.
Key Features:
- Connection Establishment: A handshake process (e.g., TCP’s three-way handshake) establishes the connection.
- Data Transfer: Data flows in an ordered and reliable manner.
- Connection Termination: The connection is closed after data transfer, freeing resources.
- Stateful: Both sender and receiver maintain connection state information throughout the communication.
Reliable Communication
Reliable communication means that the system guarantees that the data sent by the sender is received by the receiver correctly and in the same order. This involves several mechanisms:
- Acknowledgments (ACKs): The receiver sends back acknowledgments to confirm receipt of data.
- Retransmissions: If the sender doesn’t receive an acknowledgment within a timeout period, it retransmits the data.
- Error Detection and Correction: Checksums and other methods detect corrupted data and trigger retransmission. (Introduction to Transport Layer)
- Flow Control: Ensures the sender doesn’t overwhelm the receiver by regulating the data rate.
- Ordered Delivery: Ensures data segments arrive in the order they were sent.
Example:
- TCP (Transmission Control Protocol) provides reliable, connection-oriented communication widely used in web browsing, emails, and file transfers.
Unreliable Communication
In contrast, unreliable communication does not guarantee delivery, ordering, or error-free transmission of data. It sends data packets without establishing a connection or checking if the data arrives correctly.
- No acknowledgments or retransmissions.
- Data packets might be lost, duplicated, or arrive out of order.
- Less overhead and faster transmission due to simpler protocol.
- Suitable when timely delivery is more important than perfect accuracy.
Example:
- UDP (User Datagram Protocol) is a connectionless protocol that offers unreliable communication. It’s ideal for real-time applications like video streaming, voice calls (VoIP), or online gaming, where delays are worse than some data loss. (Introduction to Transport Layer)
Summary Table
Feature | Connection-Oriented (Reliable) | Connectionless (Unreliable) |
---|---|---|
Connection Setup | Required (e.g., TCP handshake) | Not required |
Data Delivery | Guaranteed, ordered, error-checked | No guarantee, packets may be lost or out of order |
Acknowledgments | Yes | No |
Retransmission | Yes, if data lost or corrupted | No |
Flow Control | Yes | No |
Use Cases | File transfers, emails, web browsing | Streaming, gaming, DNS queries |
TRANSPORT-LAYER PROTOCOLS: Simple Protocol, Stop-and-Wait Protocol
1. Simple Protocol
The Simple Protocol is a very basic communication method where data is sent without any advanced control mechanisms. It assumes the network is reliable and does not implement error checking, acknowledgments, or retransmissions.
- Features:
- No error detection or correction.
- No acknowledgment or retransmission.
- Used only in very reliable networks.
- Not practical for most real-world applications because it cannot handle errors or lost packets.
2. Stop-and-Wait Protocol
The Stop-and-Wait protocol is a simple but reliable data transfer protocol. It works as follows:
- The sender transmits one frame (packet) and waits for an acknowledgment (ACK) from the receiver before sending the next frame. (Introduction to Transport Layer)
- If the ACK is received, the sender sends the next frame.
- If the ACK is not received within a timeout period, the sender retransmits the frame.
Advantages:
- Simple to implement.
- Ensures reliable and ordered delivery of frames.
Disadvantages:
- Inefficient for high-latency or high-bandwidth networks because the sender waits idly for the acknowledgment.
- Throughput is limited as only one frame is in transit at a time.
3. Go-Back-N Protocol (GBN)
Go-Back-N is an improvement over Stop-and-Wait that allows multiple frames to be sent before needing an acknowledgment.
- The sender can send N frames without waiting for an ACK.
- The receiver only sends ACKs for the last correctly received, in-order frame.
- If a frame is lost or an error is detected, the receiver discards that frame and all subsequent frames.
- The sender, upon timeout or receiving a negative acknowledgment, goes back and retransmits the lost frame and all frames sent after it.
Features:
- Uses a sliding window of size N to control the flow of frames.
- More efficient than Stop-and-Wait, as multiple frames can be in transit simultaneously.
- Requires buffering on the sender side to keep track of unacknowledged frames.
Drawbacks:
- Inefficient if packet loss is frequent because many frames may be retransmitted unnecessarily.
4. Selective-Repeat Protocol
Selective-Repeat further improves on Go-Back-N by retransmitting only the frames that were lost or corrupted.
- The sender maintains a window of frames that have been sent but not yet acknowledged.
- The receiver individually acknowledges each correctly received frame, even if frames arrive out of order. (Introduction to Transport Layer)
- The receiver buffers out-of-order frames until missing frames arrive.
- Only erroneous or lost frames are retransmitted, reducing unnecessary retransmissions.
Features:
- Most efficient among the three protocols in handling errors.
- Requires more complex buffering and sequence number management at both sender and receiver.
- Minimizes retransmission overhead. (Introduction to Transport Layer)
Summary Table
Protocol | Description | Key Feature | Efficiency | Complexity |
---|---|---|---|---|
Simple Protocol | No error handling or acknowledgments | Basic data transmission | Low | Very Low |
Stop-and-Wait | Sends one frame, waits for ACK before next | Simple and reliable | Low (due to waiting) | Low |
Go-Back-N (GBN) | Sends multiple frames; retransmits from lost frame onward | Sliding window; retransmits blocks | Medium | Medium |
Selective Repeat | Retransmits only lost frames | Sliding window; selective retransmission | High |
Traffic Shaping
Traffic shaping is a technique used in networking to control the flow of data packets sent into a network, ensuring a smooth and steady traffic rate and preventing congestion.
Leaky Bucket Algorithm
The Leaky Bucket algorithm is a popular traffic shaping method that regulates data transmission by controlling the output rate of packets. (Introduction to Transport Layer)
How It Works:
- Imagine a bucket with a small hole at the bottom.
- Data packets arrive and are added (poured) into the bucket.
- The bucket leaks packets out at a constant, fixed rate through the hole.
- If the incoming packet rate exceeds the leaking rate, the bucket starts to fill.
- When the bucket is full, any additional incoming packets are discarded (or delayed).
This ensures that data is sent out of the network at a steady rate, smoothing bursts of traffic and preventing sudden overloads. (Introduction to Transport Layer)
Key Features:
- Constant Output Rate: The algorithm outputs packets at a steady pace regardless of bursty input.
- Buffers Bursty Traffic: Temporary bursts are buffered in the bucket.
- Packet Dropping: When the bucket is full, excess packets are dropped to avoid congestion.
- Simple Implementation: Easy to implement with hardware or software.
Benefits of Leaky Bucket Algorithm
- Controls the traffic rate effectively.
- Prevents network congestion caused by traffic bursts.
- Provides predictable and stable data flow. (Introduction to Transport Layer)
- Useful in both network traffic shaping and rate limiting.
Limitations
The fixed output rate may not be ideal for all types of network traffic, especially highly variable or bursty traffic. (Introduction to Transport Layer)
Packets can be lost if the incoming rate is too high for too long.
Token Bucket Algorithm
Token Bucket Algorithm
The Token Bucket Algorithm is a traffic shaping and rate-limiting technique that controls how data packets are sent into the network, allowing for bursts of data while maintaining an average transmission rate. (Introduction to Transport Layer)

How It Works:
- Imagine a bucket that holds tokens instead of water.
- Tokens are added to the bucket at a constant rate (e.g., 5 tokens per second).
- Each token represents permission to send a fixed amount of data (usually one packet or one byte).
- To send a packet, the sender must remove (consume) a token from the bucket.
- If enough tokens are available, packets can be sent immediately, allowing bursts.
- If the bucket is empty (no tokens available), packets must wait until tokens accumulate or get dropped. (Introduction to Transport Layer)
Key Features:
- Allows Bursts: Unlike the Leaky Bucket, the Token Bucket permits bursty traffic as long as tokens are available. (Introduction to Transport Layer)
- Average Rate Control: Tokens replenish at a steady rate, limiting the average transmission rate.
- Flexible: Can handle varying traffic rates without dropping packets unnecessarily.
- Tokens Represent Permission: Sending data depends on token availability.
Benefits of Token Bucket Algorithm
- Enables bursts without exceeding the average rate.
- More flexible than the Leaky Bucket for real-world traffic patterns.
- Prevents congestion by limiting average data flow.
- Commonly used in network devices and protocols for rate limiting.
Comparison with Leaky Bucket
Aspect | Leaky Bucket | Token Bucket |
---|---|---|
Traffic Handling | Outputs packets at a constant rate | Allows bursts up to token count |
Packet Transmission | Strict smoothing of data flow | Flexible, bursty transmissions |
Buffering | Buffers excess packets | Buffers tokens, not packets |
Use Case | Enforces strict rate control | Allows bursty traffic with average rate control |
1. DNS (Domain Name System)
- Purpose: Translates human-readable domain names into IP addresses (like 192.168.1.1).
- Function: Acts like the internet’s phonebook, allowing users to access websites using easy names instead of numeric IPs. (Introduction to Transport Layer)
- Structure: Hierarchical system with root servers, top-level domain (TLD) servers, and authoritative name servers. (Introduction to Transport Layer)
- Types of DNS queries: Recursive and iterative.
2. Electronic Mail (Email)
- Purpose: Enables sending and receiving messages electronically over the internet.
- Components:
- User Agent (UA): The client software (e.g., Outlook, Gmail).
- Mail Server: Stores and forwards email.
- Protocols Involved:
- SMTP (Simple Mail Transfer Protocol): Used for sending emails.
- POP and IMAP: Used for retrieving emails from the server.
3. Post Office Protocol (POP)
Disadvantages: Not ideal for accessing mail from multiple devices since emails are removed from the server after download. (Introduction to Transport Layer)
Purpose: A protocol used by email clients to retrieve emails from a mail server.
Versions: POP3 is the most common.
Working:
Connects to the mail server.
Downloads emails to the client.
Typically deletes emails from the server after download (POP3 default behavior).
Advantages: Simple and widely supported. (Introduction to Transport Layer)
Introduction to Transport Layer
The Transport Layer is the fourth layer of the OSI model responsible for providing reliable and efficient data transfer between two devices over a network. It manages end-to-end communication by handling segmentation, flow control, error detection, and correction. This layer ensures that data is delivered accurately, in sequence, and without loss, enabling smooth communication between applications.
Connectionless Versus Connection-Oriented Service
Connectionless Service
- Data is sent as independent packets called datagrams without establishing a dedicated connection.
- Each packet is routed separately and may take different paths to reach the destination.
- No guarantee of packet delivery, order, or error checking.
- Faster and simpler, with less overhead. (Introduction to Transport Layer)
- Example Protocol: UDP (User Datagram Protocol)
- Used in applications like live streaming, online gaming, where speed is preferred over reliability.
Connection-Oriented Service
- A connection is established between sender and receiver before data transfer begins.
- Ensures reliable, ordered, and error-free delivery of data.
- Uses acknowledgments, retransmissions, and flow control to maintain data integrity.
- Example Protocol: TCP (Transmission Control Protocol)
- Suitable for applications like file transfers, emails, and web browsing.
Reliable Versus Unreliable Communication
Feature | Reliable Communication | Unreliable Communication |
---|---|---|
Delivery Guarantee | Data is guaranteed to reach the receiver. | No guarantee; packets may be lost. |
Ordering | Data arrives in the same order sent. | Packets may arrive out of order. |
Error Control | Uses error detection and retransmission. | No retransmission or error correction. |
Acknowledgments | Receiver sends acknowledgments (ACKs). | No acknowledgments sent. |
Example Protocols | TCP | UDPConnectionless Versus Connection-Oriented Service Connectionless Service Data is sent as independent packets called datagrams without establishing a dedicated connection. Each packet is routed separately and may take different paths to reach the destination. No guarantee of packet delivery, order, or error checking. Faster and simpler, with less overhead. Example Protocol: UDP (User Datagram Protocol) Used in applications like live streaming, online gaming, where speed is preferred over reliability. Connection-Oriented Service A connection is established between sender and receiver before data transfer begins. Ensures reliable, ordered, and error-free delivery of data. Uses acknowledgments, retransmissions, and flow control to maintain data integrity. Example Protocol: TCP (Transmission Control Protocol) Suitable for applications like file transfers, emails, and web browsing. Reliable Versus Unreliable Communication Feature Reliable Communication Unreliable Communication Delivery Guarantee Data is guaranteed to reach the receiver. No guarantee; packets may be lost. Ordering Data arrives in the same order sent. Packets may arrive out of order. Error Control Uses error detection and retransmission. No retransmission or error correction. Acknowledgments Receiver sends acknowledgments (ACKs). No acknowledgments sent. Example Protocols TCP UDP |