TCP vs UDP Crash Course

Sdílet
Vložit
  • čas přidán 19. 05. 2024
  • TCP and UDP are communication protocols that allows us to send and receive data in a network. We have both for a reason since each has its advantages and disadvantages. In this video we will talk about two protocols, pros and cons of each one and will write tcp and udp server with nodejs showing you these in ACTION. We also talk about how reliable udp is used in gaming for intermitted network connection.
    Code!
    github.com/hnasr/javascript_p...
    Jump Codes 🏷
    0:00 Intro
    04:12 TCP pros cons
    19:00 Tcp demo (code)
    24:25 UDP pros cons
    31:25 UDP demo (code)
    35:40 Summary
    Explain TCP
    Pros:
    acknolwedgment,
    garenteed delivery,
    connection based
    congestion control
    ordered packets
    Cons
    Larger packets
    More bandwidth since more headers.
    Slower (because of retransmission)
    stateful once connection is lost its lost, cannot resume it.
    TCP Example (Code)
    telnet 127.0.0.1 8080
    Explain UDP
    Pros
    Statless,
    Less bandwidth
    smaller packets
    Faster to transmit
    Cons
    no ack,
    no garenteed delivery,
    no congestion control
    no ordered packets
    UDP client
    echo "foo" | nc -w1 -u 127.0.0.1 41234
    Stay Awesome!
    Hussein
  • Věda a technologie

Komentáře • 448

  • @hnasr
    @hnasr  Před rokem +6

    Get my fundamentals of networking engineering udemy course head to network.husseinnasser.com for a discount coupon

  • @jeronlloyd4703
    @jeronlloyd4703 Před 4 lety +209

    You have taught me 2 semester worth of knowledge in a few hours !!! Thanks for your long videos...love your work

    • @hnasr
      @hnasr  Před 4 lety +29

      Jeron Lloyd thanks Jeron for taking the time and leaving a comment. Really genuinely happy that I could help. Cheers !

    • @aryankumar87771
      @aryankumar87771 Před rokem

      same for me

  • @shahrukh49
    @shahrukh49 Před 3 lety +38

    Nobody in the history of mankind has ever explained tcp and udp this perfect way. Thanks.

  • @AbandonedVoid
    @AbandonedVoid Před 3 lety +12

    I highly appreciate that you go in-depth on these subjects. It really helps me to retain information when I have the full context behind it.

  • @mishrasidhant
    @mishrasidhant Před 4 lety +11

    I'm thoroughly enjoying your explanations. They're invaluable! Much love, excited to watch your channel grow. Thank you!

  • @ssreejit3674
    @ssreejit3674 Před 3 lety +32

    Great video as usual. 33:51 The reason you got 3 byte is because you piped "hi
    " and in the TCP example it was "hi
    " as it was sent by pressing enter in the terminal. 13 is the ascii number for carriage return
    and 10 is the ascii number for newline feed
    .

    • @Mastermind-pz9eu
      @Mastermind-pz9eu Před 2 lety +3

      It’s usually a windows vs unix thing. I believe that it happens because different tools were used for sending data. And they just adhere to different standards.
      The logic behind having “/r/n” is related to printers. This way you could send all file characters to the printer and it would know to go back to the left and drop to a new line. Unix (or at least the modern ones) says that it’s redundant and just rolls with “/n”.
      Sometimes this can cause weird git commit if the developers don’t stick to the same new line encoding and may even cause python scripts to malfunction on different systems.

  • @barit0n3
    @barit0n3 Před 4 lety +58

    "These exotic foreign hosts, man. They keep closing these connections, man!" 23:58 hahaha!

  • @newtonsarr1234
    @newtonsarr1234 Před 3 lety +5

    Honestly dude, I have been looking more into your tutorials and this stuff is just amazing. Love how you keep it with minimal code while demonstrating understanding for the basic concepts. Genius...I AM A FAN OF YOURS NOW.

  • @karamjotsingh7479
    @karamjotsingh7479 Před 3 lety +1

    Your channel made backend engineering more fun for me. Your videos provide the best foundation to learn about a topic and set the path to dive deeper.

  • @dylanroberts4577
    @dylanroberts4577 Před 2 lety +2

    Loved the video! Thanks, my networking prof was very boring so I skimmed these topics just to pass the course. Now that I've interviewing for backend engineering positions at large companies, all the gaps in my knowledge is coming back to bite me in the ass! Your videos are great and are really helping me go over topics that I haven't thought about for a while / barely learned. Thank you for making these, it is literally directly influencing my life. Thanks again!

  • @glenfernandes5248
    @glenfernandes5248 Před 2 lety +2

    Best video for some one who is just getting into software engineering. Love the long video format upto 40mins-1hr. Thanks a lot Hussein Nasser, you are a great teacher. Please keep adding more content!

  • @bajojohn
    @bajojohn Před 3 lety +5

    Thanks for posting these. It’s really helpful. I’m taking an intro to networking course and these videos are are way better than the course material/lectures.

  • @RoryGaddin
    @RoryGaddin Před 3 lety +6

    Thanks Hussein, you are a superb educator. Love the thoroughness in your videos. Even though I have been working as a developer in the industry for a number of years I always learn something new on this channel and it enriches my understanding of what the heck I'm trying to do. Keep up the great work!

  • @djsigmann
    @djsigmann Před 4 lety +11

    Dude, I just wanna say thanks for the video, very informative and well structured. I'll admit, your accent can be a bit hard to follow at times but overall still coherent. looking forward to watching more of your content.

  • @Maniac-007
    @Maniac-007 Před rokem +4

    I am a software engineer (backend dev primarily) for almost 2 years now. kinda got interested in the DevOps field lately and these videos are a refresher. Very well explained and I hope that others will benefit from it too. Thank you so much Nasser for your time and effort into creating videos for the 'Backend Engineering' series

  • @thatfunkyduck
    @thatfunkyduck Před 4 lety +5

    Great vid as always dude, just started liking each one and have subscribed!

  • @sebantichandra9318
    @sebantichandra9318 Před 2 lety

    thank you so much! I can finally say I have a much clearer understanding of concepts like DOS, congestion control, acknowledgment than I did earlier by mindlessly going through all those videos and pages after pages of very difficult explanation.

  • @sudhirag
    @sudhirag Před 3 lety

    Amazing stuff !!! I watched from start till the end in one sitting and not only this video but I do this for all of your videos. Keep posting, thanks.

  • @Ryfibi
    @Ryfibi Před 3 lety

    I reached until the end. And I think you do a good job explaining complex things in a NOT boring way. Cheers!

  • @devansuyadav6738
    @devansuyadav6738 Před 2 lety +2

    The best explanation to TCP and UDP through this video! Cannot emphasize how useful this was, in-depth, crisp and well-explained with examples 💯💯
    Gonna check out the entire playlist now 🙌

  • @shashikantsingh840
    @shashikantsingh840 Před 2 lety

    You are inspiring a ton of backend engineers . Having so much fun while going through your videos.Thanks a lot man:)

  • @jayjayma
    @jayjayma Před 3 lety

    Made it to the end. Thanks. Your videos really help keep me awake during long drives.

  • @matts8911
    @matts8911 Před 8 měsíci

    22:55 you had me laughing out loud 😂man, I recently found your channel and I want to say I really appreciate your videos and what you do, teaching us so much while also just sharing your thoughts and authentic self. You're helping tons of people and spreading positive energy, particularly in a community that doesn't have enough of it, imo. Thank you so much!!!!

  • @RomanFalcon13
    @RomanFalcon13 Před 3 lety +2

    I reached until the end, thanks for the long videos and all the insights!

  • @elijahlair
    @elijahlair Před rokem

    Reached to the end. Never knew you could build Servers in Nodejs for tcp and udp. Very insightful, Thanks

  • @iftekharuddin
    @iftekharuddin Před rokem

    It's like a friend is telling a story around the campfire somewhere in Mt. Shashta/NorCal and everyone is listening intently. Thanks Hussein.

  • @mtushar
    @mtushar Před rokem

    Hey Hussein, I reached the end! This was a truckload of reliable and deep knowledge for something I suck at right now. Thank you for your content as always, big fan and evangelist here :)

  • @hardikawasthi6210
    @hardikawasthi6210 Před 3 lety

    Hey, I reached until the end ! The depth of your content is really amazing. Thanks for such amazing videos.

  • @M0rdFustang
    @M0rdFustang Před 4 lety +2

    One of the better explanations on this subject on CZcams, thanks

  • @codingwithsmallsteps2878

    Hey I reached till the end. I really enjoyed your video. You put a lot of efforts to understand the concepts. Thank you for this. Plus the examples you showed were like the cherry on the cake. :)

  • @dankman7603
    @dankman7603 Před 3 lety

    I've reached the end and am now going back to The Complete Guide to WebSockets
    .
    You make back end easy to understand, thank you.

    • @hnasr
      @hnasr  Před 3 lety

      Thanks for watching! Hope you are enjoying the content , take your time and ask questions ❤️

  • @maryblessingumeh1320
    @maryblessingumeh1320 Před 3 lety +1

    I made it to the end and I am still going on to the next, thanks for the good work.

  • @vamsishankar2825
    @vamsishankar2825 Před 3 lety

    I literally binged your channel and just subscribed now.. please make lot of longer videos with in depth explanations. Really liked your videos

  • @mohamedgnana1705
    @mohamedgnana1705 Před rokem

    This was really one of the best videos I have seen on TCP and Udp. Thanks Hussein

  • @ahmedtarek8792
    @ahmedtarek8792 Před 3 lety

    Even though I knew about TCP and UDP, I reached at the end of video. You represented it so nicely. Your videos are very entertaining, I don't really feel any learning stress.

  • @hooow23
    @hooow23 Před 3 lety

    Dude, I love the way you're teaching things, and how you demystify concepts and explain them in great details.
    I would really like to support your channel, so can you please guide me on how to do that !
    Good luck hussein, you're the best.

  • @Sp3cTraLENT
    @Sp3cTraLENT Před 2 lety +1

    Newly hired backend SWE here, just letting you know I finished this video and watching your beginners backend engineering Playlist. I appreciate all the content you make.

  • @gjuoun
    @gjuoun Před 4 lety +7

    wow, I made it to the end! It refreshed my knowledge about UDP and TCP, thanks a lot!

  • @rodmajuelojr
    @rodmajuelojr Před 4 lety

    Appreciate the long explanations. Shows how knowledgable you are with the topic, includes easy to understand examples and insights. Looking forward to more!

    • @rodmajuelojr
      @rodmajuelojr Před 4 lety

      In the udp code test maybe 'w' means wait i dunno...

    • @hnasr
      @hnasr  Před 4 lety

      Thanks Rod for your message! Appreciate you

  • @zenocitium7114
    @zenocitium7114 Před 3 lety

    Man you are the GOAT! learn more from that JS code server stuff than all the hours put in before. Keep on teaching mate! Natural

  • @vladyslavkarpenko9372

    Thank you Hussein 🤝 You had described a lot of stuff that rarely even discussed in the CZcams world.

  • @nuncapierdaslaclase3216
    @nuncapierdaslaclase3216 Před 4 lety +15

    Hey I reached until the end! This is amazing! THANK YOU!

    • @hnasr
      @hnasr  Před 4 lety +2

      nunca pierdas la clase thank you 😊 i am glad you enjoyed the video!!

  • @dabbopabblo
    @dabbopabblo Před 2 lety

    God there's so much value in your videos, literally the most useful educational videos on CZcams

  • @mohammadhumayunkhan3642

    I wanna thank CZcams for recommending your video. Your style of teaching is addictive! 😃

  • @ronokdev
    @ronokdev Před 3 lety +2

    As always SPOT ON !!
    Thank you for your hard work !!

  • @amitkumargouda1768
    @amitkumargouda1768 Před rokem

    You are really helping me in getting my CS fundamental correct.

  • @raffayhussain6717
    @raffayhussain6717 Před 2 lety

    My man's been on fire lately. I really appreciate this content. It feels wrong to consume it for free, it's so good.

  • @mehrshaddarvish2762
    @mehrshaddarvish2762 Před 2 lety +1

    you always say that your videos are too long, however my friends and I are your fan because we believe you explain essential and important sessions in short videos :)

  • @dhvanitpopat2952
    @dhvanitpopat2952 Před 2 lety

    Hey I reached until the end! This is amazing! THANK YOU! looking forward to learn more

  • @dhruvbhavsar1669
    @dhruvbhavsar1669 Před rokem

    Hey Thanks so much! Really shows how much you put effort without expecting anything in return. Giving is a bliss❤

  • @ardyjovi3414
    @ardyjovi3414 Před 3 lety +1

    Made it to the end lol
    Thanks for the video, man! Thought I lost a bunch of fundamentals and now trying to recollect it slowly and your vids help a lot!
    Anyway I think you should keep post the long video, it serves the right amount of info I guess. Nice one!
    Oh and maybe you can address what to learn next or some references to check out to after watching the vids, it might help some ppl who's just trying to learn step by step

    • @hnasr
      @hnasr  Před 3 lety +3

      Thanks Ardy! And good idea to what to learn next. I can use end screens for that or a playlist.
      I suggest the TCP 3 way handhake next czcams.com/video/bW_BILl7n0Y/video.html

    • @ardyjovi3414
      @ardyjovi3414 Před 3 lety

      @@hnasr Thank you!
      Yes and actually I watch your videos starting with the Backend Engineer Playlist, in order. If it's already in the right order then it's cool! 🙇

  • @lenkamoravcikova311
    @lenkamoravcikova311 Před 3 lety

    obligatory I reached until the end :D thanks for much for this and all of your videos!

  • @bautistabuyatti6495
    @bautistabuyatti6495 Před 9 měsíci

    Coming from the field of physics and wanting to understand everything to a deeper level, this is gold to start getting into networks eng!

  • @AbhishekJaiswal608226
    @AbhishekJaiswal608226 Před 2 lety

    This is my first CZcams comment since I started watching CZcams which might be several years ago.
    I reached till the end and first time I understood the differences between TCP and UDP so clearly.
    Thanks for such crisp and detailed quality stuff

    • @hnasr
      @hnasr  Před 2 lety

      Thanks for watching! Glad you enjoyed the content

  • @shahlazulkarnine9628
    @shahlazulkarnine9628 Před 2 lety

    Hey Hussein, I reached the end. Love your tutorials, Thank you so so much!

  • @romankhabibulin3341
    @romankhabibulin3341 Před 2 měsíci

    For anyone like me who struggles to understand low level fundamentals of modern software engineering - your channel is a splendid place! Thanks so much Hussein for your hard work!

  • @sunshine-music
    @sunshine-music Před rokem +2

    We need more teachers like you. @Hussein, Kindly start teaching to teachers especially of Institutes where faculties makes interesting lecture so boring. You are amazing 🙂 !

  • @piyushkantidas
    @piyushkantidas Před 3 lety

    Just loved your presentation. Thank you for taking the time to make such great content. And yeah, I reached the end of this long 40 minutes video :D

  • @chaitanyaasati
    @chaitanyaasati Před 3 lety

    I watched till last. Thank you for showing coding part of UDP and TCP both.

  • @GuyjinBu
    @GuyjinBu Před 9 měsíci

    Great video, learned a lot! Also very good sense of humor. Looking forward to learning more from your videos!

  • @protyaybanerjee5051
    @protyaybanerjee5051 Před 3 lety +1

    Love from India, Brother. Keep making longer videos. You are a mentor i wish i had access to in person

  • @pratikgiri878
    @pratikgiri878 Před rokem

    Make a video long as long you want . I wanna understand everything in depth . Thank you so much for these videos .

  • @saifsalim6084
    @saifsalim6084 Před 3 lety +1

    I have written my networking paper by cramming all these and spitting out in the examination paper.
    But now after watching this video till end, I really learnt a lot.
    Looking forward to learn more. 😇

  • @engsalahmahmoud2418
    @engsalahmahmoud2418 Před 3 lety +4

    Hey I reached until the end! THANK YOU!

  • @pedrosanchezf
    @pedrosanchezf Před 2 lety

    I reached the end. It happened very fast in my opinion, you do it very well! I haven't researched yet. But with the stuff you've said I'm guessing this must be one of the key points that make SQL and NoSQL DBs so different. Is it because RDBMS rely on TCP (making it slower, but more reliable) and NoSQL rely on UDP (making it faster, but more prone to losing data)? And the way you talk about horizontal growth is almost the same discussion as with SQL and NoSQL DBs. It would be very interesting to find out that this topic is going to help me also with that one. Thanks again, man!

  • @johnlynch5896
    @johnlynch5896 Před 3 lety +2

    Hey Hussein, thank you! I love your passion and your humility. Would love to sit down with you with coffee to discuss the vagaries of software engineering! After watching three of your videos, I am hooked!

  • @SpinningPsycho
    @SpinningPsycho Před 3 lety

    Keep explaining the details please! Love it. Made to the end.

  • @MonikaImbibe
    @MonikaImbibe Před 10 měsíci

    I have become your fan. I have been trying to learn backend for 3 years and every time the topic came up - I procrastinated, ended up honing my skills at front-end, UI, design etc.etc. Not only your videos are so explanatory but you have made the topic so interesting that a beginner like me can truly enjoy it, would want to sneak deep into it. Thank you so much.

    • @hnasr
      @hnasr  Před 10 měsíci

      appreciate it dear thank you! all the best on your career

  • @coffeesoup
    @coffeesoup Před 3 lety

    I reached until the end! Love your vids Hussein!

  • @chandrakant2852
    @chandrakant2852 Před 11 měsíci

    Superb explanation! Glad you are helping the community. Keep up the good work :)

  • @shubhamsaxena587
    @shubhamsaxena587 Před 3 lety

    I just want to say, Absolutely love your videos. Also great point when you said your videos are long because you try to cover all information, I have seen 5 min TCP videos which don't explain anything. Keep up the good work

    • @hnasr
      @hnasr  Před 3 lety

      ❤️❤️ thank you

  • @neuodev
    @neuodev Před 2 lety

    I reached to the end. Thanks for the great work!

  • @arbaztyagi5057
    @arbaztyagi5057 Před 2 lety

    Honestly man.. enjoying your explanation.. You channel have lots of lots of high quality content videos..I must watch all of them..I am sure I'm gonna do this.

  • @pratikgaur21
    @pratikgaur21 Před 2 lety

    I reached until the end. Thanks for the effort to explain.

  • @prakhar3agrwal
    @prakhar3agrwal Před 2 lety

    Hey, I reached till the end. Awesome video. Keep up the good work. Recently joined ur channel as well :)

  • @embededmind418
    @embededmind418 Před 3 měsíci

    Hey reached till end..! Really appreciate your effort mate :)

  • @shaoyihu6354
    @shaoyihu6354 Před 3 lety +2

    Wow, your video is excellent. I refreshed my knowledge after watching it!

  • @sadsorbet3897
    @sadsorbet3897 Před 2 lety

    I'm addicted to your tutorials, thanks

  • @mohitdhingra27
    @mohitdhingra27 Před 4 lety +5

    Great work man. I really like all of your videos. It really clears the concepts. Thanks for such a good work. #KeepBeingAwesome.

    • @hnasr
      @hnasr  Před 4 lety

      mohit dhingra thanks Mohit! Appreciate it and glad I could help. Stay Awesome!

  • @vimalmunjani
    @vimalmunjani Před 4 lety +1

    This is my first comment on CZcams in life. This guy's humor and teaching skills are exceptional. GREAT CONTENT

    • @hnasr
      @hnasr  Před 4 lety +1

      I am honored to receive your first comment 😊 thank you so much for taking the time to watch. Glad you liked the content

    • @vimalmunjani
      @vimalmunjani Před 4 lety +1

      @@hnasr Hi, I see you are bit of a nodejs enthusiast too. It would be great to have a "Hussien Nasser" style video of under the hoods of node, specially event loop, libuv and related internals. Just a thought.

  • @duongcaomusic8062
    @duongcaomusic8062 Před 3 lety +1

    Hey, I reached until the end! Very useful! Thanks!

  • @shellyhan8827
    @shellyhan8827 Před 2 lety

    Really love your enthusiasm! Content is very well delivered and explained in a very entertaining way!

  • @pankajkaushik913
    @pankajkaushik913 Před 2 lety

    That is some amazing stuff Hussein. Thank you so much!

  • @j03Biz
    @j03Biz Před 3 lety

    Watched through the whole thing to broaden my backend knowledge.

  • @tuanvinhto1849
    @tuanvinhto1849 Před 3 lety +1

    Thanks for your video, it's very good to understand deeply about the network layer, now I can say I understand TCP/UDP and can make choice if needed later

  • @widyguilias3738
    @widyguilias3738 Před 3 lety +1

    I reach till the end, it's just make sense. Thanks for the video

  • @abdourahman87
    @abdourahman87 Před 3 měsíci

    Thank you so much husseine, I started my journey to be a software engineer inshaa Allah , and I can say your videos have being very helpful and has made me understand what happens under the hood.
    Allahuma barik 😊

  • @mumeich.4348
    @mumeich.4348 Před 3 lety

    I love you you make everything clear with your examples!

  • @ericlien86
    @ericlien86 Před rokem

    Gratefulness from Taiwan...really love your videos, can’t wait to watch the next one!

  • @DeepakSingh-hl3er
    @DeepakSingh-hl3er Před 3 lety

    Such a clear explanation & demo. Thanks a ton!

  • @ibukunadeeko
    @ibukunadeeko Před 2 lety

    Reached the end, thanks for the video 👍🏻

  • @tosin8885
    @tosin8885 Před 2 lety +1

    Got to the end! Thank you

  • @GREGORIAN100able
    @GREGORIAN100able Před 2 lety

    Very concise and clear. Thanks a lot Hussein.

  • @juggernaut838
    @juggernaut838 Před 3 lety +2

    Great content Hussein. One tip, upload your videos at 1.25x, this will bring down the video length.

  • @BiancaAguglia
    @BiancaAguglia Před 3 lety

    I DID reach the end. 😊Your teaching style is very good. Keep up the great work.

  • @juanferrua5743
    @juanferrua5743 Před 2 lety

    This channel is awesome. Thanks for making these videos!

  • @jbisa
    @jbisa Před 3 lety

    Your videos are amazing. Very clear explanations, thank you!!

  • @RK-xl2uq
    @RK-xl2uq Před 3 lety +1

    reached the end, not sure why i saw your videos but they are addicting so i'll watch more in coming days :)

    • @hnasr
      @hnasr  Před 3 lety

      ❤️ thank you for watching

  • @joelkarie
    @joelkarie Před rokem

    Really really good stuff. Thanks for the enthusiasm and clear examples.

  • @kurianbenoy2
    @kurianbenoy2 Před 3 lety +1

    Hey I reached until the end. Thanks and I am binge-watching your Backend playlist for beginners today