ricardomol
  • Ricardomol Notes
  • Frontend
    • Javascript Toolchain
    • Javascript
      • Quirks
      • Articles
        • Function caching
        • 12 JS Tricks
      • Closures
      • Assorted
      • ES6
      • this
      • OOP
      • Async Programming
      • Functional Programming
      • Typescript
    • React
      • Patterns
        • Render props
      • React Router
    • Webpack
    • CSS
      • Resources
  • Backend
    • Python
      • Shallow copy vs deep copy
      • Classes
      • Resources
      • Python C Extensions
      • Coroutines
      • Exceptions
      • Context managers
      • One-Liners
      • Open function
      • Object introspection
      • Targeting Python 2 + 3
      • For - else
      • Comprehensions
      • Lambdas
      • __slots__ magic
      • Collections
      • Enumerate
      • Mutation
      • Map, Filter and Reduce
      • Decorators
      • Sets
      • Fluent Python summary
      • Quizes / Tips
      • Generators
    • Django
      • Generic Relations
      • FBV's vs CBV's
      • ORM
      • DRF
    • RESTful Architecture
    • Resources
  • Databases
    • Joins
    • Normalization
    • PostgreSQL
  • DevOps
    • Docker
      • 0. Resources
      • 2. Services
      • 3. Swarms
      • 5. Stacks
      • 6. Deploy your app
    • CI
      • CI with Django
    • CD
    • PaaS
    • WSGI servers
    • Django
      • Django Deployment
    • Modern DevOps with Django
  • Git
    • Git
  • Comp Sci
    • Big O Notation
    • Patterns
    • Programming paradigms
  • Assorted
    • TCP vs UDP
    • Tests
    • MongoDB
    • Node
      • Resources
    • Go
    • HTTP vs HTTP2
    • GraphQL
    • Books
    • Vim
    • IPv4 vs IPv6
    • Regex
    • Redis
    • Celery
      • Brokers
    • Caching
  • SECURITY
    • Security
Powered by GitBook
On this page
  • TCP vs UDP
  • TCP
  • UDP
  • Quick Takeaways
  1. Assorted

TCP vs UDP

TCP vs UDP

TCP

  • Transmission Control Protocol

  • The most commonly used protocol on the internet

  • It is a connection-oriented stream over an IP network

  • Guarantees all sent packets reach the destination in the correct order.

TCP handshake or 3 way handshake: occurs between the client and server where the client sends a SYNC (synchronize) request, the server sends back and an ACK (acknowledgment) and sync, and then finally the client sends an ACK back.

Then, the client and server exchange data (with an ACK after every packet sent, to confirm that the packet safely reached it’s destination with the correct checksum). Once the client and server are done, the handshake is finished and is closed.

TCP must receive acknowledgment packets from the sender and automatically resends any transmissions loss. This causes delays and makes it slow.

UDP

  • User Datagram Protocol

  • Connection-less protocol that is datagram oriented

  • The only guarantee is the single datagram, which can arrive out of order or not at all

  • More efficient than TCP

  • Used for real-time communication (audio, video) where a little percentage of packet loss rate is preferable to the overhead of a TCP connection

Quick Takeaways

  • TCP is reliable, UDP is unreliable

  • TCP is stream oriented, UDP is message oriented

  • TCP is slower than UPD, but UDP has some signal loss

PreviousProgramming paradigmsNextTests

Last updated 6 years ago