This layer ensures that the entire message reaches its destination in order and handles the flow and error control at the source-to-destination level.
The characteristics of Layer 4 are:
- The data unit at this layer is known as a ‘segment’.
- The Transport Layer uses two transport media:
- TCP- Transmission Control Protocol
- UDP-User Datagram Protocol
TCP: This is a connection-oriented protocol. TCP user a sequence numbering to identify each byte of data transmission. The sequence number identifies the order of the bytes sent from every computer so that the data can be rearranged in the right order, regardless of any frame or packet loss, or fragmentation during transmission.
TCP Three-way Handshake
To establish a connection, TCP uses a three- way handshake.
Before a client makes an attempt to connect with a server should initially ‘listen’ at a port to open it up for connections, this is referred to as a passive open.
To determine a connection, the three-way (or 3-step)handshake occurs.
- SYN: The active open is performed by the client sending a SYN (SYN chronize)to the server. The client sets the segment’s sequence number to a random value ‘A’.
- SYN-ACK: Accordingly, the server answers with a SYNchronize-ACKnowledgement.
The acknowledged number is placed at one more than the received sequence number i.e. ‘A+1’.The sequence number that the server chooses for the packet is another random number, ‘B’.
- ACK: Finally the client sends an ACK back to the server. The arrangement number is set to the received acknowledgement value i.e.’A+1’,and the acknowledgement number is set to one more than the received sequence number i.e. ‘B+1’.
On completion of these actions ,both client and server have received an affirmation of the connection.
- Steps 1 and 2 secure the association parameter (arrangement number) for one heading and it is recognized.
- Steps 2 and 3 establish the connection parameter (sequence number) for the other direction and it is acknowledged.
With these steps, a full-duplex communication is established.
Connection oriented protocols require that a logical connection be established between two devices before transferring data.
Flow control: TCP has a mechanism of managing and tracking the amount of data transferred. This is called flow control. It manage the traffic from the sender to the receiver such that there is no overload.
Windowing: Windowing is the size or group of data segment which acknowledges the size of data that can be received by the receiver in its buffer memory.
- Whenever data is received from the sender to the receiver, it saves into the buffer memory.
- The receiver must acknowledge the window size to the sender.
- The sender must process the data based on the acknowledgement.
Buffer is a temporary memory.
UDP: This is a connectionless transmission protocol. These is no guarantee of delivery of data from source to destination and hence has no reliability.
UDP uses checksums for data integrity, and port numbers for addressing different functions at both the source and destination of the datagram.