Now in this slide you can see
that the diagram on the left-hand side is actually TCP header and
The diagram on the right hand side is a UDP header
Now in the TCP header you can see
source port number and
destination port number
Similarly in the UDP header you have source port number and destination port number
the rest of the fields in the TCP header is used for congestion control or
detection of
Corrupted packets or malformed packets and all that stuff
So I will not going to discuss any other fields in the TCP header, except the source port number and destination port number
So how does the TCP header or UDP header uses the source port number and destination port number?
So both header contains two fields the source port number and destination port number
These ports numbers are used by TCP UDP protocol to carry out communication between two and processes
that Is the process which are running on the source machine and the process which is running on the destination machine
of course, we shall limit our discussion to port numbers only.
So the other fields in the headers
Especially the TCP protocol are used for congestion control and error control and should be self studied from textbooks
again, as I said
The internal functionality of the TCP protocol is actually not that important
Because TCP protocol is actually a very standardized protocol
Once that has been implemented it hardly improves over a period of time
It is a very much standardized and it is already implemented in most operating system and
Companies or MNCs actually hardly
Modify the standard tcp/ip protocol. They just uses it.
So Internal functionality of the tcp protocol is actually more for our researchers than
is actually a piece of cake for researchers than
actually it's a piece of cake for MNCs. So that is the reason that anything that is standardized and
It's robustly implemented and is very much matured. The MNCs actually do not take much interest in discussing those things
So that is the reason that TCP protocol is actually off
It's actually not favorable from Interview point of view
the internal functionality of TCP protocol
But yeah, you should know the what is tcp protocol and what are at high at a very high level you should know
That what are the functions and operations of a tcp protocol and how does it differ from the UDP protocol?
And you should know that use case
So that is the reason that this course do not cover anything which is of less important from interview prospective
So any ways going forward
Now we should discuss the header stacking what actually is header stacking
so header stacking you have already seen the header stacking in this course, but maybe you are not familiar with the
With the technical term of it
So a header is a small chunk of leading message
So header is nothing, but it is a message, but it is a leading message
Appended in the front of a message which contains the meta information about payload data it carries
Without headers the payload data is unreadable or junk
right
So you have already studied that when you receive a packet
the first
Header in the packet is the Ethernet header
And the next header in the packet is some X header. now
how will you know whether this X header is actually IP header or this X header is actually ARP header or this X header is actually
Ipv6 header. how do you know?
you know this because the Ethernet header contains a field called type field and
this type field contains a number which actually
which is actually standardized and say that what is the type of header following after the Ethernet header
Similarly if the next handle is the IP header the IP header also contains a special field called protocol field
This protocol field contains a standardized number, which says that after the IP header, What is the next type of Header
So like this every header has to contain some information
Which conveys that what is the type of header or what is the type of message following that header
So this is actually called header stacking that is one header following after the another header and following after the another header and so on
So how would you know that network layer header
Which follows the Ethernet header is actually IP header or ipv6 header or any other
network layer protocol
Network layer header is payload to Ethernet header. Yeah
How would you know that protocol used in the transport layer is UDP or TCP protocol?
So when the packet is received on the receiving machine
The network layer of the receiving machine has to hand over the packet to the transport layer
How can the transport layer will find out that
The application is using UDP protocol or TCP protocol
Thus header H always encode some information which tells what lies ahead
right. so it's basically that if I give you once 0 1 0 0 1 0 0 0 1 and
I tell you that what what I have written
It can be present a name
It can be present some age. That's a age
Or it could represent anything
Unless I told you how to read this
These bits of message it is a junk to you
Unless I told unless I tell you how to typecast this message
In see how to typecast this message you will not be able to read these bits and bytes
So it will be a junk to you. That is the reason that every header has Some has to encode some
information
Which tells the receiving machine
That how to read the next set of bits and bytes following this header
So, let's see this header stacking in action
Suppose you have a Ethernet header in the packet
So Ethernet header
of course it will have destination MAC source MAC and
The rest of the packet is called a payload as I said that Ethernet header contains a special field called type field
The type field contains a number which is a standardized number
This standardized number actually conveys that what type of message is there in the payload
Now if this time value is 0 80 0 it means that the payload is actually a IP header
So you will typecast
the
Next set of bytes after the type field as IP header
Now, you know that it is IP header. So I will read the next sequence of bytes in the IP header format
Similarly
IP header also contains a special field called protocol field which contains a standardized number
this standardized number identifies that what is the
protocol that is running in the transport layer if this value is 6
so this is Header stacking that is ethernet layer has to convey the information that what is the next header in the packet the
IP header has to convey the information that what is the next
TCP
what is the next transport layer protocol that is running
When the transport layer and the transport layer again contains the information in the form of port number
Which actually identifies the application which is interested in receiving the packet
So ethernet layer has a type field
IP layer has the protocol field
TCP header or the transport header has the port number fields, which is destination port number and
Finally your packet reaches to the application application can have its own application specific header
Which only the application knows or which only application understand
So this is called header stacking.