TCP 3-Way Handshake and How it Works

  • Under TCP, the IP layer and the MAC layer chooses the route.
  • Above TCP, the HTTP layer builds the request and response messages.
  • TCP converts the variable-length request into segments and makes sure all parts arrive in their original order. This is the role TCP plays.

TCP Header Format

  • 0 means the end of the options list.
  • 1 means that it is for aligning option fields on 32-bit boundaries for better performance. It doesn't do anything to the TCP connection.
  • 2 means the value is the Maximum Segment Size (MSS).
  • 3 is for communicating window scale.
  • 4 and 5 are for Selective Acknowledgement (SACK).

TCP 3-Way Handshakes

  • Sync initial sequence numbers (ISN)
  • Exchange parameters (e.g., window scale factor, Maximum Segment Size, Selective Acknowledgement algorithm)
  1. The client sends an SYN message
  2. The server replies with an SYN/ACK message
  3. The client responds with an ACK message
  • the server’s ISN, and
  • the ACK number

TCP State Transition during Handshake

Takeaways

  • TCP is responsible for guaranteed message delivery which other layers don’t care about.
  • A connection is required for the responsibility.
  • To establish a connection, TCP uses a 3-way handshake.
  • The Sequence Number, the ACK Number, and flags are the key to understand the handshake.
  • Each handshake changes the TCP connection state in both client and server ends.

References

Further readings

--

--

--

a coder 🧑🏻‍💻

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Understanding Kubernetes

Container orchestrator node resources decomposition

What the hell is an API ?

let firstBlog = someThing( );

Learn Python - File Handling

How To Scrape Amazon Product Data Without Coding

Mozilla: The Greatest Tech Company Left Behind

Simple Tips to stay alert and focused while coding….

Azure Content Delivery Network (CDN)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Carson

Carson

a coder 🧑🏻‍💻

More from Medium

Calculate Annual Income Tax Using Recursive Call

Passing context across steps with pytest-bdd

A Note on Exchange Rates API

leetcode 2. Add Two Numbers