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

แชร์
ฝัง

ความคิดเห็น • 61

  • @hnasr
    @hnasr  ปีที่แล้ว +2

    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 ปีที่แล้ว +48

    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 3 หลายเดือนก่อน +1

    after 3 years this video still helps,thanks man

  • @santhanapriyan9906
    @santhanapriyan9906 4 ปีที่แล้ว +11

    You are so simple that makes agressive understanding for a beginner. Thanks for that!!!

  • @aaronbissoondial7659
    @aaronbissoondial7659 3 ปีที่แล้ว +8

    I was struggling with understanding this for a while. You made it so simple. Thank you!!

  • @Girry_
    @Girry_ 2 ปีที่แล้ว +1

    Sent from heaven. Our very own GURU.

  • @jupru220
    @jupru220 8 หลายเดือนก่อน

    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.

  • @naveenrawal9594
    @naveenrawal9594 4 ปีที่แล้ว +1

    Sir ur so good about to make understand really thank full for this video .

  • @hosaim3442
    @hosaim3442 4 ปีที่แล้ว +5

    Awesome! what a clear and beautiful explanation. Confusion cleared. Thanks a lot! 👍

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Shahzad Ahmad Bhatti thanks 🙏 😊

  • @longchen4072
    @longchen4072 4 ปีที่แล้ว +6

    Saved my day! I appreciate it as a beginner.

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Long Chen 😊🙏 glad it helped!

  • @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.

  • @colillo9939
    @colillo9939 11 หลายเดือนก่อน

    Thanks hussein for this great explanation. Saludos desde Argentina 🧉🧉

  • @raj_kundalia
    @raj_kundalia 9 หลายเดือนก่อน

    thank you so much for this!

  • @mohammade.8770
    @mohammade.8770 4 ปีที่แล้ว +1

    Awesome topic.

  • @CodeCatProgramming
    @CodeCatProgramming 4 ปีที่แล้ว +6

    You’ve helped me learn WebSockets! Thank you!

    • @hnasr
      @hnasr  4 ปีที่แล้ว +1

      Jaguar Trials glad I could help 😊

  • @TrulyLordOfNothing
    @TrulyLordOfNothing 3 ปีที่แล้ว +2

    This was a great video. Some feedback: Could find any relevant material in the content on "impact" of handhake on performance

  • @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)

  • @tech3425
    @tech3425 ปีที่แล้ว

    Ma man spittin gold

  • @brod515
    @brod515 3 ปีที่แล้ว +1

    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 11 หลายเดือนก่อน

    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.

  • @serhiihorun6298
    @serhiihorun6298 3 ปีที่แล้ว

    I will name my son after you!! Great tutors!

  • @georgebenjamin6632
    @georgebenjamin6632 3 ปีที่แล้ว

    Your explanation is excellent!

    • @hnasr
      @hnasr  3 ปีที่แล้ว

      Glad it was helpful!

  • @neerajbhatt2013
    @neerajbhatt2013 4 ปีที่แล้ว +1

    Great

  • @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

  • @paradoxcoding2191
    @paradoxcoding2191 4 หลายเดือนก่อน

    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

  • @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

  • @jhonycash6119
    @jhonycash6119 4 ปีที่แล้ว +3

    Could you make a video about QUIC please, how does it work and its handshakes?

  • @debugmedia
    @debugmedia 4 ปีที่แล้ว +3

    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 ปีที่แล้ว +2

      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 ปีที่แล้ว +1

      @@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 )

  • @6s6
    @6s6 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      Thanks Harry! I mix now. Sometimes longer or shorter videos based on the topic. But good idea!

  • @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.

  • @yashgaur9619
    @yashgaur9619 2 ปีที่แล้ว

    What's a ghost byte?

  • @VimalMistry10
    @VimalMistry10 4 ปีที่แล้ว

    Please, Make video for comparing TCP vs WebSocket. What exactly they do differenlty.

    • @hnasr
      @hnasr  4 ปีที่แล้ว +1

      Vimal Mistry I actually did compare it to tcp here check out the playlist WebSockets
      th-cam.com/play/PLQnljOFTspQUGjfGdg8UvL3D_K9ACL6Qh.html

  • @mridul1161
    @mridul1161 4 ปีที่แล้ว

    lets do elastic search also....!!!!

  • @Emmanuel-px9lk
    @Emmanuel-px9lk 4 ปีที่แล้ว

    Does TLS setup happen immediately after this handshake ?

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      kidsWillSeeGhosts correct immediately after.

  • @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

  • @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 ปีที่แล้ว +1

      Thats for a higher protocol to decide, HTTP for example uses content length header and new line

  • @rumiradaksith7776
    @rumiradaksith7776 2 ปีที่แล้ว +3

    When u remember OK is also 200 6:02

  • @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... th-cam.com/video/uuWzk8U4dJE/w-d-xo.html via @TH-cam‬

  • @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 ปีที่แล้ว +1

      @@hnasr
      Thought about that too..
      Gonna try that and get back to you

    • @sahukarinaveenkumar3188
      @sahukarinaveenkumar3188 3 ปีที่แล้ว

      @@chebalid7524 did u implemented?

  • @mukiibimoses290
    @mukiibimoses290 2 ปีที่แล้ว

    Hussein, can you please tutor me?

  • @umeshb8210
    @umeshb8210 4 ปีที่แล้ว

    sir can you navigate me to the part where u explain what happens after TCP handshake.

    • @hnasr
      @hnasr  4 ปีที่แล้ว +1

      NO Oxygen try this one Wiresharking CURL - How a single GET request translates to 10 TCP Packets
      th-cam.com/video/gOEiBliwMUA/w-d-xo.html

    • @hnasr
      @hnasr  4 ปีที่แล้ว +1

      What basically happen is optionally TLS and then the protocol

  • @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.