Check out a free preview of the full Full Stack for Front-End Engineers, v2 course:
The "IP Addresses & Protocols" Lesson is part of the full, Full Stack for Front-End Engineers, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Jem explains what an IP address is, explores different kinds of protocols, namely TCP and UDP, and demonstrates how to ping a website from the terminal.

Get Unlimited Access Now

Transcript from the "IP Addresses & Protocols" Lesson

>> Jem Young: But the Internet runs on trust. And it's a really weird concept that, collectively as humanity, we have our disagreements on politics and war and the best type of burrito, but we all collectively said, hey, let's agree on a set of standards that my computer can talk to your computer.

[00:00:19] And this is a really big deal in the course of mankind. And, no, I'm not saying the Internet's the greatest invention in the course of mankind. But the fact that we can have these disparate ideas about how software engineering should work, what's the best programming language, what's the best operating system, but we all agree on this set of standards and protocols that we can talk to each other I think is incredible.

[00:00:40] I think our cooperation is one of the things that separates us from animals, like animals can't collectively cooperate to the level that we can, and that's reflected in the Internet. Can you tell I'm passionate about what I do? That I'm talking about humanity and social sciences and all that things.

[00:00:56] But the Internet runs on this trust system, and it's a series of protocols that everybody sat down to agree to like 30 years ago or something. They said, hey, this is how my computer can talk to you. And that protocol is called IP, and that just stands for Internet Protocol, pretty easy to remember.

[00:01:13] You've probably heard TCP/IP. TCP is Transmission Control Protocol, we'll talk about that in a second. But it's just this collective idea that if I send you some data it's well-formed enough that you say, okay, I know how to accept this data. I know how to write it, read it, and I know how to send it back to you to let you know that I got it, that's the Internet Protocol.

[00:01:33] IP address you're probably all familiar with. It's a set of numbers that just denotes an address, just like a postal address, same thing.
>> Jem Young: IPv4, that's the thing that I grew up with. That's just a series of numbers, much shorter, there are, wait, I think I have it in my secret notes, I do.

[00:01:54] There are 4.3 billion IP addresses, which at the time people were like, there will never be more computers than that. We've already blown past that. We've actually run out of IP addresses. So if it gives you an idea of how ubiquitous the Internet is, there are over 3.4 billion devices connected the Internet right now, which is kind of wild when you think about it.

[00:02:14] But again, this just shows you a lesson in history to plan ahead. [LAUGH] They thought 3.4 billion was enough. It wasn't enough, we ran out. So they invented this thing called IPv6. IPv6 is a series looks like this. There's bigger numbers and there's, wait, see, I've got it in my notes, 340 decillion.

[00:02:36] I don't even know if I'm saying that right. 3.4 to 10 to the 38. That is hopefully enough. [LAUGH] Hopefully enough addresses that we won't run out anytime soon. We'll see what happens in the future, though, you never know. Maybe we'll go to Mars and by that time I'll be dead and hopefully no one's watching this course because, if so, we have bigger problems in the world.

[00:02:59] But these are IP addresses. So they're addresses that are used by the Internet Protocol to kind of talk to each other, just let you know, hey, here I am. Here's how to get to me. Like I said, this all runs on a different protocol called TCP. And most of you heard TCP over IP, or IP over TCP, it's just a protocol and a standardization of how computers can talk to each other.

[00:03:26] And you also hear the phrase UDP. Probably people are a little less familiar with UDP because it's used heavily but you probably don't use it in your day to day. Does anybody know the difference between TCP and UDP? Sam, I see you nodding. Anybody else want to take a crack?

[00:03:43] Anybody? Jimmy.
>> Speaker 2: TCP has to negotiate the connection for each file. UDP is capable of negotiating a connection and then it leaves the connection open while it's communicating with the same server. As soon as it finishes uploading or downloading the first files it says, okay, and then next and then next.

[00:04:10] So it minimizes the round trips, or the back and forth conversation, that's needed in order to begin transferring and continue transferring files.
>> Jem Young: That's exactly right, great answer. TCP it's lossless, it's guaranteed that if I send you some information over TCP it's going to make it. It has things called error correction, error checking.

[00:04:32] UDP is different where I just say, hey, and I assume you heard me and I don't care if you didn't, and that's UDP. Essentially, it's just a one-way blast of information. And you can see why UDP is faster than TCP because TCP has to say, hey, you there?

[00:04:49] And that's called a SYN packet, S-Y-N. And then the client responds like, yeah, I'm here with an ACK. So it sends an ACK package. You don't need to know this stuff, but it's just like that nerd level trivia that I, I wanna make you look cool at the bar next time you're hanging out.

[00:05:05] You're like, yeah, something's TCP and IP packets, things like that. But it negotiates this connection. So it says SYN and then it says SYN-ACK, and then it sends ACK, and then you start transferring data. So there's already four or five connections before any data is even really sent versus UDP which is just, hey, did you get it?

[00:05:24] Did you get it? Did you get it? Don't care. I'm just sending you data. I'm just sending you data. And actually I have a good joke about UDP but you might not get it.
>> Speaker 3: Just say it, though.
>> Jem Young: No, that was the joke. See?
>> Speaker 3: [LAUGH]
>> Jem Young: Thank you, thank you person in the back of the room.

[00:05:41] That was Mark. Yeah, that was some nerd jokes for you. So let's try an exercise, let's try ping. Ping is a really short request. It just says, hey, hey, hey, hey, that's all it does. So let's go in ping and into your terminal, so I'm gonna do that here.

[00:06:05] Say ping Hey, it's there, it's alive. And to kill it we just Ctrl+C. Way to kill anything, Ctrl+C. So everybody successfully, I assume if you're watching me on the Internet your Internet works and you successfully pinged And all this is saying is, hey, are you there?

[00:06:28] Are you there? Are you there? And so like, yeah, I'm here, I'm here, I'm here. Ping is useful for debugging your site. If you're saying, man, my clients are saying the connection's really slow. What's the cheapest, easiest way to find out is my site up and running? And how long's that round trip time?

[00:06:48] So the round trip refers to when I send the packet out and it comes back, and we're just measuring that. Another thing it measures is, well, I'll talk about hops in a second. I'll talk about hops and trace route. But ping is just a nice utility to have in your back pocket just to say like, hey, is the site up?

[00:07:07] Yeah, cool.