The fourth layer of the OSI model is the transport layer. Its purpose is to provide secure communication and transparent transmission of the data flow.
The data which is received from the session layer is divided into small data units called segments. Each segment contains the sender and receiver port number along with the sequence number. Port number helps to direct the data segments to the correct application and the sequence number helps to reassemble the data from data segments in the correct order. This ensures that messages are delivered error-free, in sequence, and with no losses or duplications.
The transport layer controls the flow of data by checking the capability of the receiver device before transmitting data. It is also responsible for the management of error correction by enabling the host to send and receive error-corrected data or packets over a network, providing quality and reliability to the end-user. The methods used for error checking and control are CRC (cyclic redundancy check) and checksum.
The main functionalities of the transport layer are segmentation, data transportation, and connection multiplexing. For data transportation, it uses TCP and UDP protocols. TCP is a connection-oriented protocol. It provides reliable data delivery.