This layer provides data transfer between hosts, as well as optional end-to-end error recovery and flow control. The latter is the process of adjusting the flow of data from the sender to ensure all data can be handled. This is accomplished by a a packet that is sent by the receiving side asking for a slow-down in data flow.

Additionally, Layer 4 supports session multiplexing to support multiple sessions and manage traffic across a single link.

Important

The transport layer, and therefore TCP/UDP protocols, do not include IP addresses - that is done at the Network Layer. On Layer 4 we are mostly concerned with port numbers and data reliability.

Port Numbers

Each session in Layer 4 has a port number encoded in the header that helps assign which application layer process will get that data. Note that there are two port numbers in the headers: the sender port number and the destination port number.

Info

The Layer 4 header includes source and destination port numbers. This is so that between the two different sessions can be tracked.

When a sender sends web traffic with a source port of 1500, for example, the receiver will answer by sending data from port 80 to the original source port, 1500.

TCP and UDP