1
00:00:00,240 --> 00:00:02,820
Angela: Hey guys, it's Angela from The App Brewery

2
00:00:02,820 --> 00:00:05,040
and in this lesson we're gonna deep dive

3
00:00:05,040 --> 00:00:08,610
into how exactly does the internet work.

4
00:00:08,610 --> 00:00:11,220
So what exactly is the internet?

5
00:00:11,220 --> 00:00:13,470
A lot of people think it's a cloud

6
00:00:13,470 --> 00:00:15,480
something that's hanging around in the sky.

7
00:00:15,480 --> 00:00:18,450
It's super complex, super difficult to understand

8
00:00:18,450 --> 00:00:20,490
but actually that's not it at all.

9
00:00:20,490 --> 00:00:23,160
The internet is pretty simple.

10
00:00:23,160 --> 00:00:26,850
All it is is just a long piece of wire.

11
00:00:26,850 --> 00:00:29,700
And the wire connects different computers to each other.

12
00:00:29,700 --> 00:00:32,310
So you might have one computer that's in London

13
00:00:32,310 --> 00:00:35,160
and another one that's in Seattle, and they can talk

14
00:00:35,160 --> 00:00:38,640
to each other and transfer data through this giant wire.

15
00:00:38,640 --> 00:00:40,440
Now, some of these computers attached

16
00:00:40,440 --> 00:00:42,840
to the internet have a very special job.

17
00:00:42,840 --> 00:00:47,100
They have to be online 2/7, ready to serve you all the data

18
00:00:47,100 --> 00:00:49,830
and files that you are requesting when you try to

19
00:00:49,830 --> 00:00:51,630
access a website.

20
00:00:51,630 --> 00:00:54,330
And these are called servers.

21
00:00:54,330 --> 00:00:57,720
And what they do is they serve you all the data

22
00:00:57,720 --> 00:01:00,090
and files you need to be able to access

23
00:01:00,090 --> 00:01:02,340
and interact with certain websites.

24
00:01:02,340 --> 00:01:04,950
So these computers are called servers.

25
00:01:04,950 --> 00:01:07,710
And any computer that a user would use to

26
00:01:07,710 --> 00:01:10,380
access the internet is called a client.

27
00:01:10,380 --> 00:01:12,360
Now, you can imagine a web server

28
00:01:12,360 --> 00:01:15,720
as a giant library that's open 24/7

29
00:01:15,720 --> 00:01:17,190
and you can go in there at any hour

30
00:01:17,190 --> 00:01:20,370
of the day and say, I wanna see Google's homepage

31
00:01:20,370 --> 00:01:23,310
or I wanna see the latest posts on TechCrunch.

32
00:01:23,310 --> 00:01:24,570
And it would be able to serve you

33
00:01:24,570 --> 00:01:27,180
with all the files and data you would need to

34
00:01:27,180 --> 00:01:29,490
be able to view whatever website you want.

35
00:01:29,490 --> 00:01:30,600
Now, as you can imagine

36
00:01:30,600 --> 00:01:32,905
if there's a library that's big enough to house all

37
00:01:32,905 --> 00:01:36,030
of these websites, then it's gonna be pretty

38
00:01:36,030 --> 00:01:39,660
difficult to quickly locate the thing that you want

39
00:01:39,660 --> 00:01:42,120
out of this giant library, right?

40
00:01:42,120 --> 00:01:44,493
So how is this problem solved on the internet?

41
00:01:45,330 --> 00:01:47,160
Well, let's say that you're sitting at home

42
00:01:47,160 --> 00:01:50,040
on your computer and you type in google.com

43
00:01:50,040 --> 00:01:53,340
because you wanna head over to the main Google homepage.

44
00:01:53,340 --> 00:01:56,100
Well, what happens behind the scenes is

45
00:01:56,100 --> 00:01:59,760
that your browser will send that message

46
00:01:59,760 --> 00:02:03,240
to your ISP or your internet service provider.

47
00:02:03,240 --> 00:02:05,400
So these are the people who you pay to be able to

48
00:02:05,400 --> 00:02:07,140
access the internet.

49
00:02:07,140 --> 00:02:10,830
If you live in the US, that will be AT&T or Comcast.

50
00:02:10,830 --> 00:02:12,300
And if you're in the UK,

51
00:02:12,300 --> 00:02:14,820
it'll be something like BT or TalkTalk.

52
00:02:14,820 --> 00:02:17,100
Now, the message that you're sending the ISP

53
00:02:17,100 --> 00:02:19,680
is I wanna see google.com

54
00:02:19,680 --> 00:02:22,560
and the ISP will then relay that message

55
00:02:22,560 --> 00:02:25,110
to something called a DNS server

56
00:02:25,110 --> 00:02:28,890
which stands for a domain name system server.

57
00:02:28,890 --> 00:02:33,480
And a DNS server is essentially just a souped up phone book.

58
00:02:33,480 --> 00:02:35,460
And what happens when you make that request

59
00:02:35,460 --> 00:02:38,340
through your browser is the DNS server will look

60
00:02:38,340 --> 00:02:42,570
up in its database to find the exact IP address

61
00:02:42,570 --> 00:02:45,240
of that website that you're trying to access.

62
00:02:45,240 --> 00:02:47,790
And every single computer that's connected

63
00:02:47,790 --> 00:02:50,400
to the internet has an IP address.

64
00:02:50,400 --> 00:02:53,190
It's kind of like a postal code for your computer

65
00:02:53,190 --> 00:02:55,710
so that when people need to send and receive files

66
00:02:55,710 --> 00:02:59,070
on the internet, each computer can be located

67
00:02:59,070 --> 00:03:03,090
and contacted using their unique IP address.

68
00:03:03,090 --> 00:03:06,330
And once the DNS server finds that IP address

69
00:03:06,330 --> 00:03:08,580
it'll send it back to your browser

70
00:03:08,580 --> 00:03:11,460
through the ISP over the internet.

71
00:03:11,460 --> 00:03:13,740
Then you can make a direct request

72
00:03:13,740 --> 00:03:15,795
to that address and what lives

73
00:03:15,795 --> 00:03:19,710
that that IP address is, of course the Google servers

74
00:03:19,710 --> 00:03:22,590
and they'll be able to send you back all the files

75
00:03:22,590 --> 00:03:27,360
and data you need to be able to view the Google homepage.

76
00:03:27,360 --> 00:03:29,370
Now, you can try this for yourself to look

77
00:03:29,370 --> 00:03:32,790
up the IP address of the Google homepage, head

78
00:03:32,790 --> 00:03:37,680
over to this website, NSlookup.io, and type in google.com

79
00:03:37,680 --> 00:03:40,800
and they should show you the exact IP address

80
00:03:40,800 --> 00:03:43,710
of the Google servers that you can access.

81
00:03:43,710 --> 00:03:45,060
Now, if you try checking this

82
00:03:45,060 --> 00:03:48,540
on a different day, say in a week or in a month's time,

83
00:03:48,540 --> 00:03:51,900
you might see that this address actually changes.

84
00:03:51,900 --> 00:03:54,240
And that's because many websites including Google

85
00:03:54,240 --> 00:03:57,150
use something called Dynamic IP addresses as well

86
00:03:57,150 --> 00:04:00,060
as a content distribution network or a CDN.

87
00:04:00,060 --> 00:04:02,070
This basically ensures that it gets you

88
00:04:02,070 --> 00:04:05,430
to the closest server to where you are located.

89
00:04:05,430 --> 00:04:08,610
And also this address will change depending

90
00:04:08,610 --> 00:04:11,100
on whether if it's being used or not.

91
00:04:11,100 --> 00:04:13,230
So don't type in what you see on screen.

92
00:04:13,230 --> 00:04:16,050
Instead, head over to NSlookup.io

93
00:04:16,050 --> 00:04:18,600
and look up what is the closest IP address

94
00:04:18,600 --> 00:04:21,510
to you that is currently being used.

95
00:04:21,510 --> 00:04:25,140
So if you copy it and paste it into a new tab

96
00:04:25,140 --> 00:04:27,360
then you'll be able to replicate that process

97
00:04:27,360 --> 00:04:29,730
and see the Google Homepage show up.

98
00:04:29,730 --> 00:04:33,600
So to summarize, the internet is just a bunch

99
00:04:33,600 --> 00:04:37,800
of wires that connects up different computers, but it's just

100
00:04:37,800 --> 00:04:39,750
on a much bigger scale connecting

101
00:04:39,750 --> 00:04:42,330
up all the computers in the world.

102
00:04:42,330 --> 00:04:44,970
But what about the oceans I hear you ask.

103
00:04:44,970 --> 00:04:47,460
Well, that's one of the coolest things.

104
00:04:47,460 --> 00:04:49,950
There are these massive undersea cables

105
00:04:49,950 --> 00:04:52,890
connecting all the continents on earth.

106
00:04:52,890 --> 00:04:56,010
And if you head over to submarinecablemap.com

107
00:04:56,010 --> 00:04:58,590
you can see all of these cables

108
00:04:58,590 --> 00:05:01,740
and see the ones that connect you up to the internet.

109
00:05:01,740 --> 00:05:05,760
And these undersea cables are massive consisting of hundreds

110
00:05:05,760 --> 00:05:09,960
of fiber optic fibers, each of them using lasers to transmit

111
00:05:09,960 --> 00:05:13,260
up to 400 gigabytes of data per second.

112
00:05:13,260 --> 00:05:14,640
This is a cross section of one

113
00:05:14,640 --> 00:05:17,010
of the cables that run to New Zealand.

114
00:05:17,010 --> 00:05:20,100
It's an absolute marvel of modern technology

115
00:05:20,100 --> 00:05:22,920
and it looks really beautiful, don't you think?

116
00:05:22,920 --> 00:05:25,860
And to think that every single time we load up a webpage

117
00:05:25,860 --> 00:05:29,130
or click on a button on a website, behind the scenes

118
00:05:29,130 --> 00:05:31,440
we're sending signals that navigates all

119
00:05:31,440 --> 00:05:34,800
of this crazy underwater and above water wires.

120
00:05:34,800 --> 00:05:37,860
And all I need is just an IP address.

121
00:05:37,860 --> 00:05:40,110
And through tiny electric signals traveling

122
00:05:40,110 --> 00:05:42,270
at the speed of light through the oceans

123
00:05:42,270 --> 00:05:45,630
and halfway around the world, in a matter of milliseconds

124
00:05:45,630 --> 00:05:48,390
I get to view my favorite websites.

125
00:05:48,390 --> 00:05:51,360
And that is how awesome the internet is.

126
00:05:51,360 --> 00:05:54,570
And we're gonna be taming it to build our own websites

127
00:05:54,570 --> 00:05:55,890
and web apps.

128
00:05:55,890 --> 00:05:57,300
And to be able to do that

129
00:05:57,300 --> 00:06:01,560
we first have to understand how exactly do websites work.

130
00:06:01,560 --> 00:06:03,540
So for all of that and more,

131
00:06:03,540 --> 00:06:05,140
I'll see you on the next lesson.

