Networking Transport Layer: TCP vs UDP Protocols

๐—ง๐—ฟ๐—ฎ๐—ป๐˜€๐—บ๐—ถ๐˜€๐˜€๐—ถ๐—ผ๐—ป ๐—–๐—ผ๐—ป๐˜๐—ฟ๐—ผ๐—น ๐—ฃ๐—ฟ๐—ผ๐˜๐—ผ๐—ฐ๐—ผ๐—น (๐—ง๐—–๐—ฃ)

  • A heavy-weight connection-oriented protocol that treats the data as a stream of bytes.
  • Helps us to send data without errors or duplication and receive it in the same order as it is sent.
  • Uses handshake protocols like SYN, SYN-ACK, and ACK to guarantees the delivery of data to the destination. That's why it is highly reliable but slower in performance.
  • Performs error checking and error recovery.

๐—จ๐˜€๐—ฒ๐—ฟ ๐——๐—ฎ๐˜๐—ฎ๐—ด๐—ฟ๐—ฎ๐—บ ๐—ฃ๐—ฟ๐—ผ๐˜๐—ผ๐—ฐ๐—ผ๐—น (๐—จ๐——๐—ฃ)

  • A light-weight connectionless protocol that provides an unreliable datagram connection between applications.
  • There is no fixed order of the data transmission and data can be lost or duplicated.
  • Faster in performance but does not guarantee the delivery of data to the end destination.
  • Performs error checking but not error recovery.

Applications that use TCP - Gmail, World Wide Web, etc.
Applications that use UDP - Media Streaming application like YouTube, online multiplayer games, etc.

Share Your Insights

More from EnjoyAlgorithms

Self-paced Courses and Blogs

Coding Interview

Machine Learning

System Design

Our Newsletter

Subscribe to get well designed content on data structure and algorithms, machine learning, system design, object orientd programming and math.