So let us try to understand the relationship between different layers of the TCP IP stack with the help
of a real world analogy.
So suppose we have this gentleman and this gentleman has packed his luggage because he has decided to
move from his current residence to a new residence which is few miles away from his current residence.
And for the purpose of transportation of his luggage, he has hired a courier company called Movers
and Packers.
So let us try to map various elements of this situation to the TCP IP stack.
So this gentleman who is looking to be transported to his new residence is an application and his luggage
is an application data.
And his luggage is well packed so that it do not get damaged during the course of transportation.
So this function can be mapped to the session and presentation layer because the session and presentation
layer is responsible for encryption and decryption of data so that this data cannot be compromised while
it is on the journey over the network.
The courier company is equivalent to the transport layer.
Now in the transport layer we have two famous transporting protocol, which is TCP and UDP.
So if this courier company takes the responsibility to safely transport your luggage to the destination,
then this courier company behaves as a TCP protocol.
Otherwise, if the transport company do not take the responsibility about the safety of your luggage,
then this courier company behaves like a UDP protocol.
So this courier company is responsible to transport your luggage from your current residence to your
new residence.
And therefore, this courier company acts as a transport layer.
The new apartments which this gentleman is shifting is like a destination IP address.
Now, coming to the road, the road can be thought of as a network layer because road is a path from
your current residence to your new residence.
So network Layer is actually responsible to take your data from source machine to the destination machine.
And finally, the various traffic signals which the vehicle will encounter on the road can be thought
of a data link layer because the vehicles passes through these traffic signals.
Hop by, hop in a hop by hop fashion.
So this is a good real world situation where different entities in this situation and the function performed
by those entities could be mapped well to different layers of the TCP IP stack.