TCP is a protocol that controls how information is sent on the internet. Protocol meaning a set of rules that is set between two or more things' way of communicating with each other. By the end of this lesson you will know:
Alright, imagine you're texting your crush and you want to send a sweet message, but you're also really nervous about whether they actually get it or not. So you both agree to play a little texting game to make sure everything goes smoothly. This is where TCP (Transmission Control Protocol) comes in, and it works like your texting game. Let me break it down:
Before you send your first message, you and your crush need to make sure you're both ready. You text them, "Hey, are you there?" They reply, "Yes, I'm here!" Then you confirm, "Okay, let's chat!" This is like the 3-way handshake in TCP, where your devices (like your phone and their phone) agree to talk to each other and are ready to exchange messages.
You start sending cute texts, but you don't just send one and hope for the best. You want to make sure each message is received. So, after each text, you wait for your crush to send a thumbs-up or something like "Got it!" to let you know it was received.
If your crush doesn't reply within a certain amount of time, you’ll send the message again, just to make sure they got it. This is how TCP ensures reliable delivery—by waiting for acknowledgment and resending if needed.
Sometimes, you send multiple messages in a row like:
But your crush might receive them in a different order (maybe they saw the “Let's hangout bbg” first). So, you add a little number to each text to make sure they’re in the right order when your crush reads them. This is sequence numbering in TCP—each message gets numbered so they know what order to read them in.
You don't want to overwhelm your crush by sending a thousand texts in one go, right? So you slow down and space them out, letting them catch up. TCP also uses flow control to make sure your connection doesn’t send too many messages at once, avoiding overwhelming the recipient. You are gonna get your bum to get ghosted if you do that in real life.
When the conversation is over, and you're both ready to say goodbye, you send a text saying, "Okay, talk soon!" and your crush replies, "Talk soon!" That’s like closing the connection. With TCP, when the communication is finished, both sides send a special message to officially close the conversation (a.k.a. the connection termination).
To conclude, just like how you want your crush to always get your messages and keep the convo flowing smoothly, TCP makes sure data is transferred reliably between computers. Well, only if it was so easy like that...
We use TCP because it ensures reliable and error-free delivery of data by confirming receipt, retransmitting lost packets, and organizing everything in the right order. It prevents overwhelming the receiver with too much data at once (flow control) and adjusts to avoid network congestion. Basically, TCP makes sure data is sent smoothly, correctly, and without any missing pieces, like ensuring your crush always gets your sweet messages, in order, and on time (。•̀ᴗ-)✧
As we have seen TCP is used in situations where reliability and order are critical for communication. Here are some common examples:
I sound like I am advertising TCP... Today's lesson is over for now, you may learn UDP later because it's another protocol that your favorite online game and streaming platform probably uses.