What is the difference between TCP and UDP?

The

UDP header does not contain any information that does not exist in the TCP header. In this case, why, as a programmer, must specify header information (port and IP address) when sending UDP packets, but not when sending a TCP packet?

Mar.03,2021

  1. TCP connection oriented (for example, dial up to establish a connection first.); UDP is connectionless, that is, no connection is required before sending data
  2. TCP provides reliable services. That is, the data transmitted through the TCP connection is error-free, not lost, not repeated, and arrived in sequence; UDP does its best to deliver, that is, it does not guarantee reliable delivery
  3. TCP is byte flow oriented, in fact, TCP regards data as a series of unstructured byte streams; UDP is message oriented; UDP has no congestion control, so network congestion will not slow down the transmission rate of the source host (useful for real-time applications, such as IP phones, real-time video conferencing, etc.)
  4. each TCP connection can only be point-to-point; UDP supports one-to-one, one-to-many, many-to-one and many-to-many interactive communication
  5. TCP header overhead 20 bytes; UDP header overhead is small, only 8 bytes
  6. the logical communication channel of TCP is a full-duplex reliable channel, while UDP is an unreliable channel

has excerpted an online answer to reply to you.

Menu