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

Поділитися
Вставка
  • Опубліковано 15 вер 2024

КОМЕНТАРІ • 61

  • @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 роки тому +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

  • @santhanapriyan9906
    @santhanapriyan9906 4 роки тому +11

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

  • @tourmill20
    @tourmill20 4 місяці тому +1

    after 3 years this video still helps,thanks man

  • @aaronbissoondial7659
    @aaronbissoondial7659 3 роки тому +8

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

  • @longchen4072
    @longchen4072 4 роки тому +6

    Saved my day! I appreciate it as a beginner.

    • @hnasr
      @hnasr  4 роки тому

      Long Chen 😊🙏 glad it helped!

  • @jupru220
    @jupru220 9 місяців тому

    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 роки тому +1

    Sent from heaven. Our very own GURU.

  • @hosaim3442
    @hosaim3442 4 роки тому +5

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

    • @hnasr
      @hnasr  4 роки тому

      Shahzad Ahmad Bhatti thanks 🙏 😊

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

  • @user-zs2ew9td7q
    @user-zs2ew9td7q Рік тому

    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.

  • @colillo9939
    @colillo9939 Рік тому

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

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

  • @naveenrawal9594
    @naveenrawal9594 4 роки тому +1

    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.

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

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

  • @tech3425
    @tech3425 Рік тому

    Ma man spittin gold

  • @jhonycash6119
    @jhonycash6119 4 роки тому +3

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

  • @serhiihorun6298
    @serhiihorun6298 3 роки тому

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

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

  • @georgebenjamin6632
    @georgebenjamin6632 4 роки тому

    Your explanation is excellent!

    • @hnasr
      @hnasr  4 роки тому

      Glad it was helpful!

  • @paradoxcoding2191
    @paradoxcoding2191 6 місяців тому

    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

  • @mohammade.8770
    @mohammade.8770 4 роки тому +1

    Awesome topic.

  • @raj_kundalia
    @raj_kundalia 10 місяців тому

    thank you so much for this!

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

  • @hamsal_khaldi7851
    @hamsal_khaldi7851 3 роки тому

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

  • @大花猫-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

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

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

  • @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
      ua-cam.com/play/PLQnljOFTspQUGjfGdg8UvL3D_K9ACL6Qh.html

  • @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... ua-cam.com/video/uuWzk8U4dJE/v-deo.html via @UA-cam‬

  • @neerajbhatt2013
    @neerajbhatt2013 4 роки тому +1

    Great

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

  • @yashgaur9619
    @yashgaur9619 2 роки тому

    What's a ghost byte?

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

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

  • @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
      ua-cam.com/video/gOEiBliwMUA/v-deo.html

    • @hnasr
      @hnasr  4 роки тому +1

      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 3 роки тому

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