UDP or User Datagram Protocol is the simplest connectionless transport layer protocol which simply sends packets between applications. It has very less overhead as UDP doesn’t require any session to transfer packets between applications.
Generally Real time protocols (RTP), DNS etc application uses UDP protocol.
TCP or Transmission Control Protocol is a reliable, connection-oriented protocol. TCP maintains a session between application and uses this session to send data across applications. TCP has support of acknowledgements of every packet being transferred and hence it’s reliable protocol but has higher overhead compared to UDP.
Generally FTP, HTTP etc application uses TCP protocol.
TCP vs UDP
Let’s have a look into major differences between TCP and UDP protocol.
TCP | UDP |
---|---|
TCP maintains a connection between applications and hence it is a connection – oriented protocol. | UDP doesn’t maintain any connection between application and hence it is a connection-less protocol. |
TCP has higher overhead as it must create, maintain and destroy to session after transmitting the data. | UDP has lower overhead as it simply sends data between applications. |
TCP is a reliable protocol as it guarantees the data delivery to the destination. | UDP can’t guarantee the data delivery. |
TCP supports flow control and acknowledgement of every data packet that are being sent. | UDP doesn’t have any acknowledgement support. |
TCP has extensive error check mechanism. | UDP has basic error check mechanism. |
TCP supports data sequencing. | UDP doesn’t support data sequencing. |
Retransmission of lost packets are possible. | Retransmission of lost packets are not possible. |
TCP is slower compared to UDP because of overheads. | UDP is faster as it doesn’t have much overhead. |
TCP has 20 – 60 bytes of header length. | UDP has fixed 8-byte header length. |
Since TCP maintains connections and hence it can’t support broadcasting. | UDP supports broadcasting. |
TCP has congestion avoidance support. | UDP doesn’t support congestion avoidance. |
TCP is used by FTP, HTTP, HTTPS etc protocol | UDP is mainly used by RTP, DNS, VOIP etc protocols. |