# Transport Layer Introduction
## What is the Transport Layer
The Transport layer is the fourth layer of the OSI model and the third layer of the TCP/IP model. It provides end-to-end communication services between application processes running on different hosts. The Transport layer sits between the Application layer above and the Network layer below. While the Network layer is responsible for routing packets between hosts, the Transport layer is responsible for delivering data between specific applications on those hosts and for providing the level of reliability that the application requires.
## Functions of the Transport Layer
Process-to-process communication distinguishes the Transport layer from the Network layer. While the Network layer delivers packets to a specific host using IP addresses, the Transport layer delivers data to a specific application process on that host using port numbers. A single host may be running many network applications simultaneously, and port numbers allow incoming data to be directed to the correct application.
Segmentation and reassembly involves dividing the data stream from the Application layer into smaller units for transmission and reassembling received segments into the original data stream at the destination. The size of segments is limited by the Maximum Segment Size negotiated during connection establishment.
Multiplexing and demultiplexing allow multiple application processes to use the network simultaneously. Multiplexing at the sender combines data from multiple applications and passes it to the Network layer. Demultiplexing at the receiver directs received data to the correct application based on the destination port number.
Connection management, in the case of TCP, includes establishing connections before data transfer, maintaining connections during data transfer, and properly terminating connections after data transfer is complete.
Error control ensures that data is delivered without errors. The Transport layer may include checksums to detect corruption and mechanisms for requesting retransmission of corrupted or lost segments.
Flow control prevents the sender from overwhelming the receiver by sending data faster than the receiver can process it.
## Transport Layer Protocols
The two main protocols at the Transport layer are TCP, the Transmission Control Protocol, and UDP, the User Datagram Protocol. TCP provides reliable, connection-oriented, ordered delivery. UDP provides fast, connectionless, unreliable delivery. Applications choose between TCP and UDP based on their requirements. Applications that require guaranteed delivery and correct ordering use TCP. Applications that prioritize speed over reliability use UDP.Back to Subject