What is the TCP 3-Way Handshake and Why Backend Engineers should understand it

  Рет қаралды 66,091

Hussein Nasser

Hussein Nasser

Күн бұрын

The TCP handshake is one of the most common things that happen when we establish a connection to a server. I thought I take a few minutes to explain why do we need the TCP Handshake, how does it work and its effect on the performance of applications.
Chapters
0:00 Intro
0:40 Why Do we need TCP Handshake?
4:40 Handshake Explained
8:50 Impact of Handshake on Performance
🏭 Software Architecture Videos
• Software Architecture
💾 Database Engineering Videos
• Database Engineering
🛰 Network Engineering Videos
• Network Engineering
🏰 Load Balancing and Proxies Videos
• Proxies
🐘 Postgres Videos
• PostgresSQL
🚢Docker
• Docker
🧮 Programming Pattern Videos
• Programming Patterns
🛡 Web Security Videos
• Web Security
🦠 HTTP Videos
• HTTP
🐍 Python Videos
• Python by Example
🔆 Javascript Videos
• Javascript by Example
👾Discord Server / discord
Support me on PayPal
bit.ly/33ENps4
Become a Patreon
/ hnasr
Stay Awesome,
Hussein

Пікірлер: 61
@hnasr
@hnasr Жыл бұрын
To learn more about networking fundamentals check out my udemy course Fundamentals of Networking for Effective Backends Head to network.husseinnasser.com for a discount coupon
@asfar1984
@asfar1984 3 жыл бұрын
being in the industry for over 10y as Networking background, sometimes these nitty gritty details are just overlooked. The whole idea of jumping on your 10mins videos .... just brings it back to your top with additional knowledge. What a channel, I have almost watched each and every single video and I am falling in love in Software Engineering
@tourmill20
@tourmill20 2 ай бұрын
after 3 years this video still helps,thanks man
@aaronbissoondial7659
@aaronbissoondial7659 3 жыл бұрын
I was struggling with understanding this for a while. You made it so simple. Thank you!!
@santhanapriyan9906
@santhanapriyan9906 4 жыл бұрын
You are so simple that makes agressive understanding for a beginner. Thanks for that!!!
@jupru220
@jupru220 7 ай бұрын
I'm studying Google cybersecurity and your explanations help me to better understand the concepts. Thank you so much for your kindness in sharing your knowledge.
@Girry_
@Girry_ 2 жыл бұрын
Sent from heaven. Our very own GURU.
@hosaim3442
@hosaim3442 4 жыл бұрын
Awesome! what a clear and beautiful explanation. Confusion cleared. Thanks a lot! 👍
@hnasr
@hnasr 4 жыл бұрын
Shahzad Ahmad Bhatti thanks 🙏 😊
@longchen4072
@longchen4072 3 жыл бұрын
Saved my day! I appreciate it as a beginner.
@hnasr
@hnasr 3 жыл бұрын
Long Chen 😊🙏 glad it helped!
@naveenrawal9594
@naveenrawal9594 4 жыл бұрын
Sir ur so good about to make understand really thank full for this video .
@86Saurabh1
@86Saurabh1 4 жыл бұрын
Great video. This helps to understand the handshake in more practical way. Just wanted to know whether you have already created the video for TCP termination as well. Apologies for asking as I know you are already creating lot of quality content.
@CodeCatProgramming
@CodeCatProgramming 4 жыл бұрын
You’ve helped me learn WebSockets! Thank you!
@hnasr
@hnasr 4 жыл бұрын
Jaguar Trials glad I could help 😊
@colillo9939
@colillo9939 10 ай бұрын
Thanks hussein for this great explanation. Saludos desde Argentina 🧉🧉
@bassamalmutairi173
@bassamalmutairi173 3 жыл бұрын
thank you for this amazing video, but I have a question does the third message of the three-way handshake need a seq number or not? (ACK that the client send after receive the SYN/ACK from the server)
@raj_kundalia
@raj_kundalia 8 ай бұрын
thank you so much for this!
@serhiihorun6298
@serhiihorun6298 3 жыл бұрын
I will name my son after you!! Great tutors!
@mohammade.8770
@mohammade.8770 4 жыл бұрын
Awesome topic.
@TrulyLordOfNothing
@TrulyLordOfNothing 3 жыл бұрын
This was a great video. Some feedback: Could find any relevant material in the content on "impact" of handhake on performance
@brod515
@brod515 3 жыл бұрын
when is a new tcp connection started. meaning how long does a tcp connection last, or when is it closed. is every request to a website a new tcp conneciton?
@user-zs2ew9td7q
@user-zs2ew9td7q 10 ай бұрын
how could you explain a complicated concept in such a simple way. It helps a lot to also explain the reason of synchronization, acknowledgement and random sequence number for both server and client. Thank you.
@paradoxcoding2191
@paradoxcoding2191 3 ай бұрын
Hi Hussein I have question about the actual get request you send request from the client and server sends ack for it and then I assumed server should know is really client get the ack for it because maybe client send this tcp request again if he doesn't get ack My question is does client send ack for also ack? Thank you for response
@georgebenjamin6632
@georgebenjamin6632 3 жыл бұрын
Your explanation is excellent!
@hnasr
@hnasr 3 жыл бұрын
Glad it was helpful!
@parasarora5869
@parasarora5869 3 жыл бұрын
Sir, I am confused about one thing. When server sends that ACK 700 and SYN 200, then 200 is the sequence of the packets that server will send as response to get request ??
@hamsal_khaldi7851
@hamsal_khaldi7851 3 жыл бұрын
Can you explain the OSI and TCP/IP please, thank you
@tech3425
@tech3425 Жыл бұрын
Ma man spittin gold
@shehabbadawy9523
@shehabbadawy9523 Жыл бұрын
05:30 i'm not a network engineer but i have read once that the randomness is to ensure that there is no confusion with other packets
@debugmedia
@debugmedia 4 жыл бұрын
Your videos are amazing, I don't know why your are not viral yet. Also wanted to ask a question, There is a registration form, whenever someone register , I need to show the live count of the people registered on the home page, but there could be 3k+ users at the same time. So If I want to display the live count, 2option will be to call an API everysecond for 3k users or WebSockets. Everyone told me wesockets , because the api could overload the server. But my question is if API will overload the server , wont websocket load the server too? Cuz its technically sending and receving data from the server. Would appreciate your suggestion on this
@hnasr
@hnasr 4 жыл бұрын
Debug Media I think the websocket approach or SSE is good in this case. Server side logic 1) User opens page 2) a websocket connection established with server 3) cron job runs on server every 10 seconds , get count and push the count to every websocket connection in the server. (Repeat for every server in the cluster) 4) 3k users register at once, database updated 5) cron job picks up next 10 seconds and push new count to all clients. The trick is to run some load balancing in case many users open many pages so you handle the load. I talked about that in scaling load balancers in websockets The load will be the database to be honest here so if you can maximize the time to hit the db the better 10 seconds is enough... You have to add some local cache on the server (state) of the current count of users and push that number for people who just joined the server (new wrb socket connection) so page doesn’t open up empty for 10 seconds Again thats one solution obviously .. you can come up with others that use pull model but that require caching and might be more complicated Does it make sense? What have you come up with? And what do other people reading this think? Would love to know 👍
@debugmedia
@debugmedia 4 жыл бұрын
@@hnasr 3k users won't be registering at the same time, But it's more like 3k sockets will be created as they visit the page so they can see the live count. So, currently, I'm calling an API on the refresh of the page, till I find a solution to this. Because I thought creating 3k sockets might affect the server, it is deployed on AWS. But I will give your solution a shot with the cron job.! Thank you so much. In one of the video, you said you were in Bahrain. I am in Dubai, But I don't speak Arabic (cuz that's what usually people ask when I say I am in Dubai haha )
@jhonycash6119
@jhonycash6119 4 жыл бұрын
Could you make a video about QUIC please, how does it work and its handshakes?
@neerajbhatt2013
@neerajbhatt2013 4 жыл бұрын
Great
@abbashussain2417
@abbashussain2417 2 жыл бұрын
Sending the HTTP GET request is oversimplified in the video and can lead to confusion. You have mixed the application layer and transport layer. Any application layer data can be divided into multiple transport layer request response.
@6s6
@6s6 4 жыл бұрын
We need to learn more about the ACKs and how the TCP connection is closed... I can't wait for the next video :) You also could've put it all together as a 30 minute video (like how you normally do - or are you prefer to do shorter videos now?)
@hnasr
@hnasr 4 жыл бұрын
Thanks Harry! I mix now. Sometimes longer or shorter videos based on the topic. But good idea!
@yashgaur9619
@yashgaur9619 2 жыл бұрын
What's a ghost byte?
@Emmanuel-px9lk
@Emmanuel-px9lk 4 жыл бұрын
Does TLS setup happen immediately after this handshake ?
@hnasr
@hnasr 4 жыл бұрын
kidsWillSeeGhosts correct immediately after.
@papajohnvspapajhin6541
@papajohnvspapajhin6541 2 жыл бұрын
Doesn't the server also need to know the total number of packets to know when all of them have arrived? Or it receives another acknowledgement from the client when it has sent the acknowledgements for all of the individual packets?
@hnasr
@hnasr 2 жыл бұрын
Thats for a higher protocol to decide, HTTP for example uses content length header and new line
@VimalMistry10
@VimalMistry10 4 жыл бұрын
Please, Make video for comparing TCP vs WebSocket. What exactly they do differenlty.
@hnasr
@hnasr 4 жыл бұрын
Vimal Mistry I actually did compare it to tcp here check out the playlist WebSockets kzbin.info/aero/PLQnljOFTspQUGjfGdg8UvL3D_K9ACL6Qh
@sundaramjha1776
@sundaramjha1776 4 жыл бұрын
what is Iptables? why it is exist & how we whitelist other particular site to consume our API. if could you please create a video.
@hnasr
@hnasr 4 жыл бұрын
Sundaram Jha here is one ‪usecase --Port forwarding with NAT and iptables (transparent proxying) - “Run” you... kzbin.info/www/bejne/q6a6q55uipmXgKc via @KZbin‬
@mridul1161
@mridul1161 4 жыл бұрын
lets do elastic search also....!!!!
@chebalid7524
@chebalid7524 3 жыл бұрын
Hey..Hussien So here is what my ISP does to deny me service. It allows three way handsake( SYN, SYN ACK, ACK) successful but then when clienthello is sent, the DPI injects a RST packet both to the client request and server request hence closing the connection on both ends.. So iam like hmmmm ,,, Cant i somehow trigger both the client and server to ignore the RST packet and continue with the handsake hence establishing a successful connect.. ...... Planning to implement simple client and server to test this theory maybe in python but have basic coding skills(need your recommendation)
@hnasr
@hnasr 3 жыл бұрын
I would instead encrypt the entire packet so the ISP can’t find out the domain your going to, try TLS 1.3 and ESNI ?
@chebalid7524
@chebalid7524 3 жыл бұрын
@@hnasr Thought about that too.. Gonna try that and get back to you
@sahukarinaveenkumar3188
@sahukarinaveenkumar3188 3 жыл бұрын
@@chebalid7524 did u implemented?
@rumiradaksith7776
@rumiradaksith7776 2 жыл бұрын
When u remember OK is also 200 6:02
@user-rf4oj6rm5n
@user-rf4oj6rm5n 2 жыл бұрын
Both sides need to prove their abilities of sending and accepting data. If only 2 handshakes, only client knows that server has proper abilities of sending and receiving data but server doesnt know whether client can accept data as well, so client need to reply server its ability. Then both sides can trust each other. Thats my understanding
@umeshb8210
@umeshb8210 3 жыл бұрын
sir can you navigate me to the part where u explain what happens after TCP handshake.
@hnasr
@hnasr 3 жыл бұрын
NO Oxygen try this one Wiresharking CURL - How a single GET request translates to 10 TCP Packets kzbin.info/www/bejne/nYComnWintyAi6M
@hnasr
@hnasr 3 жыл бұрын
What basically happen is optionally TLS and then the protocol
@mukiibimoses290
@mukiibimoses290 2 жыл бұрын
Hussein, can you please tutor me?
@gautamdikshit9888
@gautamdikshit9888 3 жыл бұрын
You hit the mike? lmfao wth??
@RakeshTheRikky
@RakeshTheRikky 2 жыл бұрын
stop doing drama and concentrate on content. this pitch up-down is irritating.
Layer 4 vs Layer 7 Proxying In Details Explained with Examples
24:24
Hussein Nasser
Рет қаралды 24 М.
How TCP Works - The Handshake
13:53
Chris Greer
Рет қаралды 306 М.
Неприятная Встреча На Мосту - Полярная звезда #shorts
00:59
Полярная звезда - Kuzey Yıldızı
Рет қаралды 7 МЛН
Получилось у Вики?😂 #хабибка
00:14
ХАБИБ
Рет қаралды 7 МЛН
No-Nonsense Backend Engineering Roadmap
10:16
Codebagel
Рет қаралды 174 М.
TCP and the Three-Way Handshake Explained [Follow-Along Lab] 🚀
11:48
TCP | 3 Way Handshake | TCP Handshake | HINDI | TCP CONNECTION ESTABLISHMENT
26:15
The Confused Engineer 😜
Рет қаралды 841
How TCP really works // Three-way handshake // TCP/IP Deep Dive
1:01:10
When to use UDP vs TCP in Building a Backend Application?
20:33
Hussein Nasser
Рет қаралды 22 М.
Using Wireshark to capture a 3 way handshake with TCP
4:47
danscourses
Рет қаралды 95 М.
TCP - Three-way handshake in details
4:17
Sunny Classroom
Рет қаралды 201 М.
TCP-3 Way Handshake Explained
6:03
HackerSploit
Рет қаралды 41 М.
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 538 М.
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 5 МЛН