Segmentation and Reassembly
One of the key functions of the Transport Layer in the OSI model is segmentation and reassembly, ensuring that large amounts of data can be transmitted efficiently and reliably across networks and reconstructed accurately at the destination.
What Is Segmentation?
Segmentation is the process of breaking down large data streams into smaller units called segments before transmission.
Why it needed:
- Networks have limits on how much data can be sent in a single packet (known as the MTU – Maximum Transmission Unit).
- Smaller units allow for better error handling and efficient use of bandwidth.
Example: If an application needs to send a 10 MB file, it might be broken into 1,000 segments of 10 KB each for transmission.
What Is Reassembly?
Reassembly is the process of reconstructing the original data at the receiving end by putting the segments back in the correct order.
This is handled by:
- Sequence numbers added to each segment.
- The receiver uses these numbers to reassemble segments in order.
- If any segment is missing, the sender can retransmit it (in TCP).
Example: Imagine sending a book by mail.
You tear the book into individual pages (segmentation), number each one, and mail them separately.
At the destination, someone collects all pages and puts them back together using the page numbers (reassembly).
How It Works in TCP (Transmission Control Protocol)
Sender:
- Breaks the data into segments.
- Adds headers that include sequence numbers and port information.
- Sends the segments one at a time.
Receiver:
- Receives the segments.
- Uses the sequence numbers to reassemble the data.
- Sends acknowledgments (ACKs) for the received segments.
If a segment is lost or corrupted:
- The receiver does not send an acknowledgment for that segment.
- The sender retransmits the missing segment.
UDP (User Datagram Protocol), in contrast, does not guarantee reassembly — it sends datagrams without sequence or retransmission.