Suggest an editImprove this articleRefine the answer for “What does the OSI transport layer do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**The transport layer** provides *end-to-end delivery of data between applications on different devices*, and controls **how data is split, transmitted, checked, and reassembled**. **Key point:** the transport layer is responsible for reliable or fast data transfer between hosts, providing segmentation, error control, flow control, and port handling; the main protocols are TCP and UDP.Shown above the full answer for quick recall.Answer (EN)Image**The transport layer** provides *end-to-end delivery of data between applications on different devices*, and controls **how data is split, transmitted, checked, and reassembled**. Short formulation for an interview: > **The transport layer is responsible for reliable or fast data transfer between hosts, providing segmentation, error control, flow control, and port handling. The main protocols are TCP and UDP.** --- ## Main functions of the transport layer (L4) ### 1. Data segmentation and reassembly The transport layer: - splits application data into **segments (TCP)** or **datagrams (UDP)** - reassembles them back into a stream after delivery --- ### 2. Segment numbering Each segment gets a number (sequence number), which allows: - assembling data in the correct order - detecting lost segments This is a key mechanism of TCP. --- ### 3. Controlling data delivery L4 determines exactly how data is transmitted: #### TCP: reliable delivery - acknowledgments (ACK) - retransmission - ordering of segments - congestion control - three-way handshake #### UDP: fast delivery - *delivers without guarantees* - used where speed matters and packet loss is acceptable - no handshake, no ACK, no ordering control --- ### 4. Flow control Allows the receiver to regulate the amount of data the sender transmits. TCP uses the **Window Size** mechanism: - if the buffer overflows, the window shrinks - if data is processed quickly, the window grows --- ### 5. Error control The transport layer checks data for errors: - TCP uses a checksum - if data is corrupted, the segment is dropped and resent UDP also uses a checksum, but it does not guarantee reliability. --- ### 6. Multiplexing by ports The transport layer uses **port numbers**: - a port determines which application the data is intended for - one IP address can serve many applications at the same time Example ports: - 80: HTTP - 443: HTTPS - 53: DNS - 22: SSH --- ### 7. Establishing and terminating a connection (TCP) A TCP connection goes through stages: - SYN → SYN/ACK → ACK: establishment - FIN/ACK → FIN/ACK → ACK: termination UDP does not establish connections. --- ## Transport layer protocols #### TCP (Transmission Control Protocol) - reliable - connection-oriented - guarantees delivery - error control - congestion control - used by: HTTP(S), FTP, SSH, SMTP, IMAP #### UDP (User Datagram Protocol) - fast - no delivery guarantee - connectionless - used by: VoIP, streaming, games, DNS --- ## What the transport layer does NOT do The transport layer **is not responsible for**: - routing (that is layer 3) - MAC addresses and frames (that is layer 2) - encryption (layer 6, 7) - access to the transmission medium (layer 2) --- ## Example of the transport layer at work Suppose you visit a website: 1. The browser sends an HTTP request: L7 2. The data is passed to TCP: L4 3. TCP splits it into segments and numbers them 4. L3 adds IP addresses and creates a packet 5. L2 adds a MAC address and forms an Ethernet frame 6. The data goes out onto the network 7. On the server, TCP reassembles the segments and checks the order 8. It passes the reassembled data to the HTTP serverFor the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.