logo

TCP vs UDP

TL;DR

  • UDP: fire and forget.
  • TCP: guaranteed delivery and the correct order of the packets.

TCP vs UDP

TCP (Transmission Control Protocol)

  • A connection-based protocol that provides a reliable flow of data between two computers.
  • Example: HTTP, FTP, Telnet
  • Use socket

UDP (User Datagram Protocol)

  • A protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival. UDP is not connection-based like TCP.
  • Example: time request, ping
  • Use datagram