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

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 62

  • @hnasr
    @hnasr  2 года назад +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 4 года назад +49

    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

  • @santhanapriyan9906
    @santhanapriyan9906 4 года назад +11

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

  • @tourmill20
    @tourmill20 6 месяцев назад +1

    after 3 years this video still helps,thanks man

  • @Girry_
    @Girry_ 2 года назад +1

    Sent from heaven. Our very own GURU.

  • @jupru220
    @jupru220 Год назад

    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.

  • @aaronbissoondial7659
    @aaronbissoondial7659 4 года назад +8

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

  • @shehabbadawy9523
    @shehabbadawy9523 2 года назад +1

    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

  • @longchen4072
    @longchen4072 4 года назад +6

    Saved my day! I appreciate it as a beginner.

    • @hnasr
      @hnasr  4 года назад

      Long Chen 😊🙏 glad it helped!

  • @CodeCatProgramming
    @CodeCatProgramming 4 года назад +6

    You’ve helped me learn WebSockets! Thank you!

    • @hnasr
      @hnasr  4 года назад +1

      Jaguar Trials glad I could help 😊

  • @colillo9939
    @colillo9939 Год назад

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

  • @MaryMa-v4r
    @MaryMa-v4r Год назад

    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.

  • @hosaim3442
    @hosaim3442 4 года назад +5

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

    • @hnasr
      @hnasr  4 года назад

      Shahzad Ahmad Bhatti thanks 🙏 😊

  • @TrulyLordOfNothing
    @TrulyLordOfNothing 4 года назад +2

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

  • @serhiihorun6298
    @serhiihorun6298 3 года назад

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

  • @jhonycash6119
    @jhonycash6119 4 года назад +3

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

  • @naveenrawal9594
    @naveenrawal9594 4 года назад +1

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

  • @tech3425
    @tech3425 Год назад

    Ma man spittin gold

  • @raj_kundalia
    @raj_kundalia Год назад

    thank you so much for this!

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

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

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

  • @georgebenjamin6632
    @georgebenjamin6632 4 года назад

    Your explanation is excellent!

    • @hnasr
      @hnasr  4 года назад

      Glad it was helpful!

  • @mattp6460
    @mattp6460 2 месяца назад

    thanks

  • @mohammade.8770
    @mohammade.8770 4 года назад +1

    Awesome topic.

  • @大花猫-i3o
    @大花猫-i3o 3 года назад

    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

  • @hamsal_khaldi7851
    @hamsal_khaldi7851 3 года назад

    Can you explain the OSI and TCP/IP please, thank you

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

  • @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
      ruclips.net/p/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... ruclips.net/video/uuWzk8U4dJE/видео.html via @RUclips‬

  • @neerajbhatt2013
    @neerajbhatt2013 4 года назад +1

    Great

  • @mridul1161
    @mridul1161 4 года назад

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

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

  • @paradoxcoding2191
    @paradoxcoding2191 8 месяцев назад

    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

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

  • @rumiradaksith7776
    @rumiradaksith7776 3 года назад +3

    When u remember OK is also 200 6:02

  • @yashgaur9619
    @yashgaur9619 2 года назад

    What's a ghost byte?

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

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

  • @Emmanuel-px9lk
    @Emmanuel-px9lk 4 года назад

    Does TLS setup happen immediately after this handshake ?

    • @hnasr
      @hnasr  4 года назад

      kidsWillSeeGhosts correct immediately after.

  • @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
      ruclips.net/video/gOEiBliwMUA/видео.html

    • @hnasr
      @hnasr  4 года назад +1

      What basically happen is optionally TLS and then the protocol

  • @chebalid7524
    @chebalid7524 4 года назад

    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  4 года назад

      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 4 года назад +1

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

    • @sahukarinaveenkumar3188
      @sahukarinaveenkumar3188 3 года назад

      @@chebalid7524 did u implemented?

  • @mukiibimoses290
    @mukiibimoses290 3 года назад

    Hussein, can you please tutor me?

  • @gautamdikshit9888
    @gautamdikshit9888 4 года назад

    You hit the mike? lmfao wth??

  • @RakeshTheRikky
    @RakeshTheRikky 3 года назад

    stop doing drama and concentrate on content. this pitch up-down is irritating.