Transport layer gathers chunks of data it receives from different sockets and encapsulate them with transport headers. Passing these resulting segments to the network layer is called multiplexing. The reverse process which is delivering data to the correct socket by the transport layer is called demultiplexing.
What does the transport layer do?
Layer 4 of the OSI Model: Transport Layer provides transparent transfer of data between end users, providing reliable data transfer services to the upper layers. The transport layer controls the reliability of a given link through flow control, segmentation and desegmentation, and error control.
What services does transport layer provide?
All transport layer protocols provide multiplexing/demultiplexing service. It also provides other services such as reliable data transfer, bandwidth guarantees, and delay guarantees. Each of the applications in the application layer has the ability to send a message by using TCP or UDP.