TCP was so confusing when I first heard it. I thought data just flew through the air, but it turns out there are a lot of rules to make sure it doesn't get lost. Here is my blog draft for the TCP assignment…
TCP: The Protocol That Never Lets Us Down
Imagine if we sent a text but the middle of the sentence just disappeared. That would be a disaster for code! We use TCP (Transmission Control Protocol) to make sure our data actually arrives in one piece.
1. Why do we even need TCP?
The internet is a messy place. Sometimes packets (tiny bits of data) get lost, arrive out of order, or get corrupted. If we didn't have rules, our images would look like static and our code wouldn't run. TCP is the "manager" that makes sure everything is perfect.
2. The 3-Way Handshake (The Secret Handshake)
Before we send any real data, the Client and Server have to agree to talk. It's like a polite conversation:
* SYN (Synchronize): We say, "Hey, I want to talk, Here is my starting number."
* SYN-ACK (Synchronize-Acknowledge): The Server says, "I hear you and I also want to talk, and I got your number. Here is mine"
* ACK (Acknowledge): We say, "Got it… Let's start sending data now."
3. How Data Stays Reliable
TCP doesn't just send everything at once and hope for the best. It uses Sequence Numbers.
* Ordering: If packet 2 arrives before packet 1, TCP waits and puts them in the right order for us.
* Acknowledgements: Every time the server gets data, it sends an "ACK" back to say "I got it"
* Retransmission: If we don't get an ACK back, we assume the packet got lost and we send it again automatically.
4. Fixing Mistakes (Packet Loss)
If a packet gets lost on the way, TCP notices a gap in the sequence numbers. It won't let the app see the data until that missing piece is found and resent. It's like a puzzle that won't let you finish until every piece is there.
5. Saying Goodbye (Closing the Connection)
When we are done, we don't just hang up. We use FIN (Finish) and ACK to tell each other we are closing the doors. It's a clean breakup so no data gets stuck in the pipes.
Conclusion
TCP is a bit slow because of all this checking, but we need it for things like websites and files where every single bit matters. It’s the reason the internet actually works…
Comments
Join the discussionNo comments yet. Be the first to comment.