This course has been updated! We now recommend you take the Full Stack for Front-End Engineers, v3 course.
Transcript from the "Packets" Lesson
[00:00:00]
>> Jem Young: Can anybody explain what a packet is? Just take it take a shot at that. What do you think a packet is?
>> Speaker 2: A bit of information.
>> Jem Young: Exactly, right. It's a little bit of information. It's the smallest bit of information you can transmit. Well, technically a bit is the smallest information you can transfer it.
[00:00:16] But a packet is, think of it like an envelope. An envelope with data in it. And what does an envelope have on it, if you're trying to mail something? It's got an address about where you're trying to get to. It's got information about where you're coming from, just in case and when it has to come back.
[00:00:32] And inside that packet has the information. And that's what a packet is. It's just this base unit of information of how everything's transmitting. Fact, the way I'm talking to you on the internet is just billions, and trillions, and trillions of packets are moving right now. But a packet mainly contains metadata.
[00:00:49] People think it's mainly data, like when you mail an envelope you're thinking, I sure hope someone gets my letter or this thing I bought off the internet. But really what the packet is, what the the key information is, where it's going, where it came from, and then all these metadata attached to it.
[00:01:04] So that metadata is usually in the form of headers. But again, the packet is it's not just like these video packets I'm sending out over the internet right now. It's not just one packet. It's trillions of them and often using TCP. It starts with one and it says like, hey, I've got one.
[00:01:20] And there's 50 more of my cousins coming along too. And then when they hit the server, it puts them all together in a checksum. And that's why TCP is called error correcting because it has all these packets, and it says like, hey, there's 50 packets. And the client says, hey, I got all of them except for two.
[00:01:37] I'm missing 49 and 37. And that sends it back to the server and the server says, I acknowledge that. Let me send those last two packets. That's why it's called error correcting because you're guaranteed to get this packet every single time. Versus UDP which sends UDP packets which are just broadcasting data.
[00:01:54] It doesn't matter if you get the rest of the packets. Eventually they'l come through. Because it doesn't error correct. That's why TCP is faster.