Facebook Pixel

The Transport Layer

The Transport Layer is the fourth layer of the OSI model. While the Network Layer is responsible for moving a packet from one computer to another, the Transport Layer is responsible for moving data from a specific process (application) on the sender machine to a specific process on the receiver machine.

It provides logical end to end communication. This means that from the perspective of the communicating applications, it appears as though they are connected by a direct, reliable link, completely hiding the complex physical network underneath.

Key Functions

  • Process to Process Delivery: Uses Port Numbers to identify exact applications. For example, when you have a web browser and an email client open simultaneously, port numbers ensure incoming web data goes to the browser and email data goes to the email client.
  • Multiplexing and Demultiplexing: Multiplexing gathers data from multiple applications and wraps them in headers to send over a single network link. Demultiplexing occurs at the receiver, where the Transport Layer strips the headers and directs the data to the correct application based on port numbers.
  • Flow Control: Regulates the speed of data transmission to strictly ensure a fast sender does not overwhelm a slow receiver.
  • Error Control and Sequencing: Detects corrupted packets, requests retransmissions for lost data, and ensures packets that arrive out of order are reassembled in the exact original sequence.

The Three Way Handshake

For connection oriented communication, the Transport Layer must establish a dedicated logical connection before any actual data is transmitted. This is accomplished using a strict 3 Way Handshake to guarantee both the client and server are fully ready.

  • Step 1: SYN: The Client sends a Synchronization (SYN) segment to the Server containing its Initial Sequence Number. This acts as a formal request to open a connection.
  • Step 2: SYN ACK: The Server receives the request and replies with a SYN ACK segment. This acknowledges the client's sequence number and formally proposes its own server sequence number.
  • Step 3: ACK: The Client receives the server's proposal and sends a final Acknowledgement (ACK) back to the server. The connection is now officially established.

Why exactly three steps? A simple two step process would leave the server unsure if the client actually received its acknowledgement. The third step provides mandatory mutual confirmation.

Core Transport Layer Protocols

1. Transmission Control Protocol (TCP)

TCP is a strictly connection oriented and highly reliable protocol. It guarantees that all data sent will eventually reach the destination without errors and in the exact correct order. It achieves this by tracking sequence numbers, forcing acknowledgements, and strictly retransmitting lost packets.

2. User Datagram Protocol (UDP)

UDP is a connectionless and unreliable protocol. It blindly fires data packets (called user datagrams) at the destination without establishing a connection and without waiting for any acknowledgements.

Because it skips the complex error checking and handshake processes of TCP, UDP is significantly faster. It is used in scenarios where speed is critical and a few lost packets are acceptable, for example, during live video streaming or online fast paced gaming.

3. Stream Control Transmission Protocol (SCTP)

SCTP is an advanced protocol that combines the best features of both TCP and UDP. It provides reliable, connection oriented transport but is highly optimized for scenarios involving multiple IP addresses (multi homing) and simultaneous data streams.

Comparison: TCP vs UDP

FeatureTCP (Transmission Control Protocol)UDP (User Datagram Protocol)
Connection TypeConnection oriented (requires 3 Way Handshake).Connectionless (sends data immediately).
ReliabilityHighly reliable. Guarantees data delivery.Unreliable. Does not guarantee delivery.
SpeedSlower due to heavy error checking and acknowledgements.Extremely fast and highly efficient.
Header SizeVariable length, typically 20 to 60 bytes.Fixed at exactly 8 bytes.
RetransmissionAutomatically retransmits lost or corrupted packets.Does not retransmit lost packets at all.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.