Feature | TCP | UDP |
Acronym for | Transmission Control Protocol | User Datagram Protocol. |
Connection Type | TCP is a connection-oriented protocol, which means it requires the establishment of a connection to transfer data and the termination of that connection once the data has been transmitted. | UDP is a connectionless protocol, which means it doesn’t require establishing, maintaining, or terminating a connection to send data. |
Segmentation | TCP allows segmentation, breaking the entire message into segments, assigning a sequence number to each segment, and then reassembling the segments into the original message based on the sequence numbers at the receiving end. | UDP does not support segmentation. In UDP, there is no data sequencing. If sequencing is required, it has to be managed by the application layer. |
Reliability | TCP is reliable as it guarantees data delivery to the destination router. | UDP is unreliable as it does not guarantee the delivery of data to the destination. |
Error checking | TCP provides error-checking mechanisms and also makes error recovery. | UDP follows basic mechanisms of data checking like checksums. |
Retransmission | In TCP, if a data packet is lost, it is possible to retransmit the lost packet. | It is not possible to retransmit a lost data packet in UDP. |
Speed | TCP is slower than UDP. | UDP is faster than TCP. |
Acknowledgment | In TCP, an acknowledgment segment is present. | UDP has no acknowledgment segments. |
Header Length | TCP uses a variable-length (20-60) bytes header. | UDP has a fixed-length header of 8 bytes. |
Flow Control | TCP uses a flow control technique to ensure that no more than a certain number of data packets are sent to the receiver at the same time. | The UDP protocol has no such mechanism. |
Broadcasting | TCP does not support broadcasting. | UDP supports broadcasting. |
Handshake | SYN-ACK, SYN, and ACK protocols are used by TCP to establish connections. | UDP does not need any handshake protocol because it is a connectionless protocol. |
Optimal Use | TCP is used by HTTPS, HTTP, SMTP, POP, FTP, etc | The UDP protocol is used by DNS, VoIP, media streaming, video conferencing systems, and other applications. |