Packets and Ports
I am a computer and I just received this piece of data from some computer way out
there on the Internet.
The problem is I don't know what this data is for.
See if you looked at my monitor right now I'd have three or four web pages open.
I'm checking my email, I'm playing World of Tanks and somebody is trying to call me
on Skype all at thesame time.
So I've got a bunch of conversations going on with a bunch of different computers
all over the Internet.
So what is this piece of data for?
And more importantly, like I said, it's a piece of data.
It's not a complete data.
It's not a full word document.
It's not all of my e-mail.
It's just a little bit of a piece of it.
So I've got two big issues I've got to deal with.
First of all how do I get this to the right application, and secondly how do I
ensure that the data that I'm trying to get gets to my computer complete full
working guaranteed?
So to deal with the first one what we're going to do, which is take a look at my IP
packet here and we're going to add a little bit more to the packet.
What we're going to do is we're going to add two more pieces of information called
port numbers. Port numbers are unique to individual applications that are used all
over the Internet.
For example port 80 is used to define a web page.
So any time you see port 80 that means this piece of conversation has something to
do with the World Wide Web.
Now keep in mind that this is a packet that is going out to a web server.
When this packet comes in to the web server he's going to look at that 80 and he's
going to go "oh this needs to go to the web server" and start dealing with this
data.
The second number is how the data gets back to my computer after the web server
starts responding.
So what will take place is when this data comes back the IP addresses will change.
And then this will switch over also.
So if I've got three different web pages open I'm going to have three different
numbers here and then that way when this packet comes into my computer depending on
what this number is it will know which web page to send it to.
So I can have three or four or five or 100 web pages open and it will get to the
right place.
Now the port number that when we send it is kind of important. Because the first
1024 port numbers are what are known as well-known ports.
You can port numbers up to about 65535, but the first 1024 are reserved.
I can never use that as a return port number.
So these are all kind of famous and on the Network Plus you're going to need to
know what port 80 is for HTTP, port 20 and 21 are for FTB, all kinds of different
port numbers that you're going to have to have memorized for the Network Plus and
we will take care of that and other episodes.
But for right now appreciate that we have port numbers. Ports are the tool that we
use that once the data gets into the computer that it makes sure that it gets to
the right application.
However ports are only part of the equation.
The other problem is right here. This is a piece of data.
It's not a whole data it's a piece of data.
This could be a piece of a Microsoft Word document or it might be part of my email
or one twenty five thousands of a web page.
And the problem is is that I want my whole web page, I want my entire Microsoft
Word document.
And that's where TCP comes into play.
TCP stands for Transmission Control Protocol, and Transmission Control Protocol is
a connection oriented conversation between two computers to make sure that the data
gets to you whole complete and in order.
Two big pieces of TCP are what we call a sequencing number, which if you break this
up into 25000 pieces the sequence number allows you to reassemble everything
properly, as well as the acknowledgment that when a data set comes in the
acknowledgment is when I talk to the other computer and say "got it, everything's
good."
The beautiful part about TCP is that it's the overwhelming protocol that we use on
the Internet and that's why we call it TCP IP and not something else.
Speaking of something else there is one other protocol that we use to move data
between one computer to another called UDP.
UDP is similar to TCP with one big glaring difference.
It is not connection oriented.
In a UDP environment one computer just sends the data and hopes that you're ready
for it.
If the data doesn't come to you in good order it's up to the application itself to
verify the data and then try again.
So keep in mind that we have two protocols TCP and UDP. TCP is connection oriented
and UDP is connectionless First 1024 port numbers are what are known as well-known
ports.
Port 80 Webserver HTTP
Port 443 Webserver HTTPS
You can port numbers up to about 65535, but the first 1024 are reserved
Port 20 FTP
Port 21 FTP
Port numbers help direct packet traffic between the source and destination
Packets have sequence numbers so the network software can reassemblt the file
correctly