Welcome to Exploring Computing.
Today's video is Computer Networks, Protocols
of the Internet.
So, as I alluded to in the last lecture,
protocols on the internet are layered.
And this is sometimes a little difficult to understand,
but it is important to understanding
how the internet really works.
I like to teach layered protocols by analogy.
So, let's start off with a little hypothetical here.
Suppose, after I'm done teaching at Stanford,
I retire and I move to Maine.
And I've always been good working with my hands,
I used to build models.
And so, I decide I'm going to go build some wooden toys.
And the wooden toys end up being quite popular.
And so, people around the world ask if they can buy my toys.
Somebody from Stanford, a former student in California
wants to buy one of my toys.
And so, what do I do?
Well, here's a possibility.
I hire to truck.
And my truck takes the toy out to a train station,
and we transfer the toy to the train station.
And the train goes to Chicago, and then it
transfers to another train.
And then ends up somewhere in Los Angeles.
And then I hire another truck to take the toy from Los Angeles
out to wherever my former student's living.
So, this will get the toy to my former student,
assuming I can manage the complexities of running
an entire transportation network.
But this doesn't seem like a very good idea, does it?
Now, I don't want to do this.
I want to concentrate on building the toys.
I don't want to deal with any of the transportation stuff.
What I'd would like to do is, I'd like to take the toy
and drop it off at the FedEx office,
and magically have it appear at my former student's house.
Now, all the steps that I previously
attempted to go through, like hiring trucks, working out
train schedules, selling trucks with gasoline,
that all still happens.
But the difference is, I'm not dealing with it, FedEx is.
And so, the same sort of process occurs
when we're developing software for the internet.
Ultimately, there are people that
do work at that bottom layer, at the layer where somebody
is trying to figure out how to fill up the trucks,
or working out the train schedules.
But most programmers programming applications on the internet
don't deal with that level of complexity.
Instead, they do the equivalent of dropping off
some information at the FedEx office,
and having it magically appear on the other end.
So, what we're going to do is, we're
going to take a look at what's sometimes
referred to as the internet protocol stack.
And we're going to take it from the bottom layer, that
filling the truck up with gas layer
where the rubber really hits the road,
and we're going to see the different layers that
are built on top.
Until we get up to the top layer, which
is where the applications happen,
where they do the equivalent of dropping information off
at FedEx and it magically appears at the other end.
All right.
So, this is the internet protocol stack.
Down at the bottom layer, we have the physical layer,
and that's the layer--
Basically, the level where we're filling the truck
with gasoline.
And then we have a number of layers on top of that.
And then at the top layer, we have the application layer,
and that's the layer where people are just dropping
packages off at FedEx.
So, let's take a look at each of these layers
and see how they work.
The first layer, the bottom layer, is the physical layer.
When we're working at the physical layer,
we need to decide exactly how we're transmitting information
to using 0's and 1's.
So, for example, when we're transferring information
over the telephone, are we going to have a 1070 hertz tone
or are we going to have it 2025 hertz tone?
And which one of those is going to represent 0,
and which one of those is going to represent 1?
We need to figure out what the physical connections look like.
We need to figure out how everything
is going to fit together.
Now, the thing about the physical layer
is, any time you come up with a new network,
you are going to have to define a new physical layer.
And we're going to find that this is not
the case with all the layers.
But the lower layers, we need to define a new copy every time
we have a new type of network.
So, if I decide that the best way to get information
across the Pacific is to have a bunch of sharks with frickin'
laser beams on their head, then I
need to figure out how those sharks are going to transmit
0's and 1's across the Pacific.
On top of the physical layer is the network layer.
The protocol at the network layer is the internet protocol.
This is the same internet protocol
that we saw when we were seeing IP addresses.
While this layer is built on top of the physical layer,
it's still quite primitive.
All information sent with the internet protocol
is going to be limited to 64 kilobyte packet.
And these packets will include the IP address
of the sender, the IP address of the recipient, a checksum,
which is a means of trying to determine if something
accidentally messed with some of the bits
in the packet, and then the actual data.
One of the things that particularly makes this network
layer a bit annoying to work with
is, there's no delivery guarantee.
The internet protocol layer says it
will make the, quote, "best effort" end quote,
to get the package to the destination.
So, one of the questions is, why do we have
this really primitive layer?
And the answer is because, again, any time we
have a new type of network we want to define,
we need to define the physical layer
and we need to define the network layer.
So, going back to my sharks with frickin' laser beams example.
I need to get those sharks to somehow line up
to get packets from one side of the Pacific to the other side.
I don't want to deal with a more complex protocol.
I want the simplest protocol possible.
Because I'm having enough trouble just trying
to get these sharks aligned.
So, because the network layer is relatively simple,
it's going to be relatively easy for somebody
to come up with a new network type,
and implement the network layer on that new network type.
Going up a layer, we have the transporter layer.
There's actually several protocols
that work at this layer, but by far the most famous
is the Transmission Control Protocol, or TCP.
The TCP protocol basically acts as our FedEx does.
What we're going to be able to do with the Transmission
Control Protocol is, it's going to build
on top of the network layer and, ultimately,
on top of the physical layer.
And we're going to be able to just drop off
packages at the transmission layer
and they will magically appear at the other side.
TCP and IP are often considered the key internet protocols,
the most important protocols of the internet.
Let's take a look at how these two work together
to get their job done.
So, what we have here is a video of The Lord of the Rings,
The Fellowship of the Ring.
It's 2.53 gigabytes, and that actually
means I made this little interactive video back
before we had high definition televisions in widespread use.
So, at 2.53 gigabytes, this movie
is too large to fit into our individual 64 kilobyte packet.
So, if we want to send this movie, what needs to happen is,
it needs to be divided up into all these little packets.
And this is something that TCP is going to do for us.
So, as somebody who's building on top of TCP,
I hand the movie to TCP.
TCP breaks the movie down into all
these little individual packets.
And if you work it out, there are over 663,000 packets
for the entire movie.
What TCP is going to do is, it's going
to number each of the individual packets,
and it's going to mark the packets with the IP
number of the source computer and the IP number
of the destination computer.
It is then going to start sending
the packets through the internet using the Internet Protocol.
As we previously discussed, the Internet Protocol
does not guarantee transfer, it just makes a best effort.
Among other things, this means some packets will get lost
and some packets will arrive in the wrong order.
Now, what TCP is going to do is, it
is going to keep track of the different packets.
If the packets arrive in the wrong order,
it is going to reorder them to the correct order.
And even nicer, it's going to keep track
of the total number of packets.
And if some of the packets are missing,
it will send a request using IP back to the original computer
saying, hey, that packet didn't show up,
can you send me another copy.
And then that copy will get sent over.
From the point of view of somebody who is using TCP,
this is all completely hidden.
As far as the user of TCP is concerned,
we just have a direct connection from one computer
to the other computer.
We can shovel whatever information
we want into this connection, and it will magically
appear on the other side.
Finally, that brings us to our last layer, the application
layer.
This is the layer where all the stuff
you guys care about happens.
So, we have a whole bunch of mail protocols--
SMTP, POP IMAP.
The protocol for the web, HTTP, is here.
There's file transfer protocols, like FTP and Secure FTP.
And basically, every program that
is on the network that does anything,
needs to have some sort of a protocol.
They may be well specified protocols
that are publicly available and that different programs can
interoperate with, or they may be completely proprietary.
But ultimately, as we've seen previously,
if two computers are on the network
and are operating together, there
needs to be some sort of formal agreement between those two
computers.
And that formal agreement is a protocol.
But, as we've seen, the application layer
is built on top of the other layers.
So, if you come up with some great, cool new idea
for a brand new type of application on the internet,
you do not have to go back and say,
hey, I need to figure out how to move those packets around,
I need to know how to reorder those packets.
That is completely handled for you by TCP.
You're just going to hand things to TCP,
and TCP will take care of that.
You do not have to worry about--
Hey, am I running this over a Wi-Fi network,
am I running this over fiber optic cable,
am I running this over a patch with sharks with frickin' laser
beams network.
That is all completely hidden by the lower layers.
So, you can see that this layer protocol really
provides some great advantages to the people
on the top layers.
There are some other handy implications
of the fact that everything down below is handled by packets.
Consider for example, I'm sitting in my dorm room
and I'm trying to download The Lord of the Rings.
Now, it turns out that all internet traffic
from our particular floor, travels through the same cables
to the wider internet for the university.
And so, without packets, while I'm
downloading The Lord of the Rings,
nobody else can do anything.
But because the traffic is broken down
into packets, what's going to happen
is, I will get my little 64 kilobyte packet
from The Lord of the Rings.
Maybe my friend next door is watching the movie, Up.
She'll get her 64 kilobyte packet from Up.
I'll get a packet from The Lord of the Rings.
Maybe somebody is actually trying to get some work done,
they'll get some email in.
And basically, the packets will all be sharing the same cable.
And some packets will come in for me,
some packets will come in for somebody else.
People will be able to get work in in between our packets.
And again, if we were to send everything
in just one large chunk, maybe you
get the same amount of traffic through,
but everybody would have to sit around and wait
for that big chunk to come through.
So, the fact that things are broken down into packets
is actually pretty great.
Another situation which packets work really
well is when they're being used for communication purposes.
So, if you look into telecommunications,
you'll discover that there is two different ways
that telecommunications can happen.
You can either have what's called circuit switching, which
is traditionally how telecommunications
has happened, or you can have packet switching.
And actually, everything's been moving to packet switching.
You may have noticed that the telephones at Stanford
are often Cisco phones.
You may think, I thought Cisco was a networking company,
I didn't think they were a telephone company.
Well, we're using Cisco phones because the Cisco phones
use internet packet technology.
And it turns out, internet packet technology
is just much more efficient than traditional telephones.
So, let's take a look at how this actually works.
So, I've mentioned my friend Tammy several times.
And she moved to Italy a long while back.
And so, we would talk on the phone.
And using traditional circuit switching technology,
what happens is, when I'm on the phone talking to Tammy,
there is a dedicated line between Stanford and Italy.
And so, it may not be a single line,
it actually is a series of lines going
through different switching stations.
But ultimately, all along the way,
there is a specific wire, while I'm on the phone with her,
completely dedicated to the two of us.
And if we're talking, it's going great, we're using our wire.
And if we're mad at each other and not saying a whole lot--
Well, those lines are still completely dedicated to us,
even though we're not saying anything.
So, this is not necessarily the most efficient use
of these wires that are these cables that are
connecting Stanford to Italy.
Now, you may have noticed that most
of the calls that some of you have
been making to friends overseas is actually completely free.
Maybe you're using something like FaceTime,
or Google Hangouts, or something like that.
Those technologies use internet packets.
And so, what's happening in those situations is,
instead of you having a completely dedicated circuit
between you and, say, your friend in the Bing Overseas
program in South Africa.
What's happening is, your voice is
being chopped up into these little 64 kilobyte packets.
Those packets are being shoved into the network,
along with everybody else's packets.
And your packets are going to arrive out on the other end.
And because the lines are now shared,
it's not as expensive as when the lines were dedicated.
And to be perfectly honest, the telephone system
between here and Italy was not so great
that having a dedicated line necessarily
led to great results anyway.
So, maybe FaceTime is for the best.
Although, I have had not so great
experiences using Skype to people out in South Africa.
So, a lot of it depends on how the internet connection
is going.
And that actually brings up another interesting point
about how the whole packet situation works.
Because the packets are being shared
on the line with everything else,
sometimes the packets get bottled up along
with the rest of the internet traffic.
And so, what's happening is, on the other end,
you're receiving a package and you have to decide--
Gee, I'm missing this packet.
But if I wait too much longer before playing the video,
my users are going to think this is getting a little bit weird.
So, maybe I should go ahead and play the video
before that package arrives, and we're just
going to have a glitch.
So, there's all sorts of interesting situations
that can occur because this information is
being sent in packets.
All right.
That's it for our study of the internet
and the internet protocols.
Where we're going to move to next week is,
we're going to start looking at the World Wide Web,
and we're going to start learning how to make web pages.
I'll talk to you soon.
Have a great weekend.