Hey guys, it's Angela from The App Brewery
and in this lesson we're going to deep dive
into how exactly does the Internet work.
So what exactly is the Internet?
A lot of people think it's a cloud
something that's hanging around in the sky.
It's super complex, super difficult to understand
but actually that's not it at all.
The Internet is pretty simple.
All it is is just a long piece of wire.
And the wire connects different computers to each other.
So you might have one computer that's in London
and another one that's in Seattle, and they can talk
to each other and transfer data through this giant wire.
Now, some of these computers attached
to the Internet have a very special job.
They have to be online 24/7, ready to serve you all the data
and files that you are requesting when you try to
access a website,
and these are called Servers.
And what they do is they serve you all the data
and files you need to be able to access
and interact with certain websites.
So these computers are called Servers,
and any computer that a user would use to
access the Internet is called a Client.
Now, you can imagine a web server
as a giant library that's open 24/7
and you can go in there at any hour
of the day and say, I want to see Google's homepage
or I want to see the latest posts on TechCrunch,
and it would be able to serve you
with all the files and data you would need to
be able to view whatever website you want.
Now, as you can imagine
if there's a library that's big enough to house all
of these websites, then it's going to be pretty
difficult to quickly locate the thing that you want
out of this giant library, right?
So how is this problem solved on the Internet?
Well, let's say that you're sitting at home
on your computer and you type in google.com
because you want to head over to the main Google homepage.
Well, what happens behind the scenes is
that your browser will send that message
to your ISP or your Internet Service Provider.
So these are the people who you pay to be able to
access the Internet.
If you live in the US, that will be AT&T or Comcast.
And if you're in the UK,
it'll be something like BT or TalkTalk.
Now, the message that you're sending the ISP
is I want to see google.com
and the ISP will then relay that message
to something called a DNS server
which stands for a Domain Name System server.
And a DNS server is essentially just a souped up phone book.
And what happens when you make that request
through your browser is the DNS server will look
up in its database to find the exact IP address
of that website that you're trying to access.
And every single computer that's connected
to the Internet has an IP address.
It's kind of like a postal code for your computer
so that when people need to send and receive files
on the Internet, each computer can be located
and contacted using their unique IP address.
And once the DNS server finds that IP address
it'll send it back to your browser
through the ISP over the Internet.
Then you can make a direct request
to that address and what lives
at that IP address is, of course the Google servers
and they'll be able to send you back all the files
and data you need to be able to view the Google homepage.
Now, you can try this for yourself to look
up the IP address of the Google homepage, head
over to this website, NSlookup.io, and type in google.com,
and they should show you the exact IP address
of the Google servers that you can access.
Now, if you try checking this
on a different day, say in a week or in a month's time,
you might see that this address actually changes.
And that's because many websites including Google
use something called Dynamic IP addresses, as well
as, a content distribution network or a CDN.
This basically ensures that it gets you
to the closest server to where you are located,
and also this address will change depending
on whether if it's being used or not.
So don't type in what you see on screen.
Instead, head over to NSlookup.io
and look up what is the closest IP address
to you that is currently being used.
So if you copy it and paste it into a new tab
then you'll be able to replicate that process
and see the Google Homepage show up.
So to summarize, the Internet is just a bunch
of wires that connects up different computers, but it's just
on a much bigger scale connecting
up all the computers in the world.
But what about the oceans I hear you ask.
Well, that's one of the coolest things.
There are these massive undersea cables
connecting all the continents on earth.
And if you head over to submarinecablemap.com,
you can see all of these cables
and see the ones that connect you up to the Internet.
And these undersea cables are massive consisting of hundreds
of fiber optic fibers, each of them using lasers to transmit
up to 400 gigabytes of data per second.
This is a cross section of one
of the cables that run to New Zealand.
It's an absolute marvel of modern technology
and it looks really beautiful, don't you think?
And to think that every single time we load up a webpage
or click on a button on a website, behind the scenes
we're sending signals that navigates all
of this crazy underwater and above water wires.
And all I need is just an IP address.
And through tiny electric signals traveling
at the speed of light through the oceans
and halfway around the world, in a matter of milliseconds
I get to view my favorite websites.
And that is how awesome the Internet is.
And we're going to be taming it to build our own websites
and web apps.
And to be able to do that
we first have to understand how exactly do websites work.
So for all of that and more,
I'll see you on the next lesson.