So first of all, we will be going to study in detail that what actually data encapsulation is
So first of all, data encapsulation
happens on a sending machine
So in our example the machine A is the sending machine and the machine D is the destination machine
the communication is happening on the application 1 which is running on the sending machine and
Application 2 which is running on the destination machine
and let us suppose that the application 1 wants to send a
Very simple data to the application 2 and let the data be just how are you?
Just a text message
So let us
See what happens in data encapsulation
Process that will happen on machine A when machine A tries to send a data to the machine D
So the application running on the machine A is
APP1
which generates a data
Which is simple a text message. How are you?
So the data that is generated by the application is called application data
Once the data is generated by the application, the application
Passes its data to the layer running below it. That is the transport layer
the transport layer receives the data from the application and the transport layer attaches its own header and
As I have already mentioned that the transport layer encodes the identity of the receiving machine and sending machine
so here the transport layer encodes the identity of the
receiving process running on the destination machine D
optionally the transport layer may also choose to
specify
the identity of the sending process that is app 1
So once the transport layer
Attaches its own transport header. It passes the rest of the
Message to the layer running below it. That is the Network layer
the network layer attaches its own header called Network header and
Again, the network header means encoding the information
Of sending machine and receiving machine
So the sending machine is A and the receiving machine is D
So once the network layer has encoded its own network header
It passes the combined message to the next layer running below it in the tcp/ip stack, which is a data link layer
And
Data link layer does the same thing it attaches its own header called mac header
which contains the MAC address of the machine A and
The MAC address of the machine B
So where from this machine B came?
So machine B is a machine, which is next Hop towards D from A
It means that if a wants to send the data to the destination machine D
than B is the next hop
So Mac header encodes the information
in the form of MAC addresses that is MAC address of the machine A and MAC address of the next hop and
Eventually the data link layer
places the data on the wire
So this is a big picture of what happens in data encapsulation on sending machine
Here are a few points to note here
Are that that whenever any layer attaches its own header, it do not even read
The other headers which are already attached by the layers above it
Every layer is just concerned with its own header
It never examined or it never reads what is there in the
Other headers which are already present in the packet
This is true for data encapsulation as well as data decapsulation