Transport layer is fourth and middle layer in the OSI reference model, which is responsible entire message delivery from source to destination and insures data integrity of the message.
Functions and responsibilities of transport layer :
Fragmentation and reassembling - Splits the message received from session layer into segments (small packets) and assigns each segment a sequence number and sends it to the lower layer.
At receiving end these segments of sequence number allows transport layer to reassembly the message properly and to check and replace lost and damaged segments in the transmission.
Connection Control - Transport layer can be connectionless or connection-oriented. A connectionless is unreliable with less overhead where each packet is treated as independent packet.
Connection-oriented is reliable with high overhead, where connection should be established before transmitting a packet.
Flow and Error Control - Performs at the level of source and destination i.e. end-to-end, instead of across a single link like data link layer.
Protocols used: TCP, UDP, ARP, RARP, ATP ,NetBIOS/NetBEUI etc.