TCP in crush terms

crush

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:

How does TCP work??

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:

  1. Establishing Connection ヽ(~_~(・_・ )ゝ
  2. 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.

  3. Sending Message ( ´ ▽ ` )ノ
  4. 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.

  5. Ordering Messages (シ_ _)シ
  6. 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.

  7. Flow Control \(〇_o)/
  8. 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.

  9. Closing the Connection (╥﹏╥)
  10. 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...

Why do we use this protocol?

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 (。•̀ᴗ-)✧

Where do we use it?

As we have seen TCP is used in situations where reliability and order are critical for communication. Here are some common examples:

  1. Web Browsing (HTTP/HTTPS): When you visit a website, TCP is used to ensure that all the parts of the webpage are delivered correctly and in order, so the page loads properly.
  2. Email: When you send or receive emails, TCP ensures that all the email data is transferred accurately and completely, even if it's a large attachment.
  3. File Transfers: When you upload or download files, TCP guarantees that the files are transferred correctly, without missing or corrupt data.
  4. Remote Access (SSH, Telnet): When you access a remote server, the protocol makes sure that all your commands and data sent between your computer and the server are received intact and in the right order.

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.