Difference between TCP & UDP
Parameter TCP UDP
It is a communications protocol, using It is same as the TCP
which the data is transmitted between protocol except this doesn’t
systems over the network. In this, the guarantee the error-checking
data is transmitted in the form of and data recovery. If you use
Definition
packets. It includes error-checking, this protocol, the data will be
guarantees the delivery and preserves sent continuously,
the order of the data packets. irrespective of the issues in
the receiving end.
TCP is a connection-oriented protocol. UDP is a connectionless
Design
protocol.
Application processes make a Application processes
Connection connection before messages can be exchange messages without
exchanged creating a connection
TCP is more reliable as it provides UDP, on the other hand,
error checking support and also provides only basic error
guarantees delivery of data to the checking support using
Reliability destination router. checksum. So, the delivery
of data to the destination
cannot be guaranteed in UDP
as in case of TCP.
In TCP, the data is transmitted in a There is no sequencing of
particular sequence which means that data in UDP in order to
Data transmission packets arrive in-order at the receiver. implement ordering it has to
be managed by the
application layer.
TCP is slower and less efficient in UDP is faster and more
performance as compared to UDP. efficient than TCP.
Performance
Also TCP is heavy-weight as
compared to UDP.
Retransmission of data packets is Retransmission of packets is
Retransmission possible in TCP in case packet get lost not possible in UDP.
or need to resend.
The Transmission Control Protocol In UDP, there is no data
has a function that allows data to be sequencing. The application
Sequencing sequenced (TCP). This implies that layer must control the order
packets arrive at the recipient in the if it is necessary.
sequence they were sent.
TCP uses a variable-length (20-60) UDP has a fixed-length
Header size
bytes header. header of 8 bytes.
Handshakes such as SYN, ACK, and It's a connectionless protocol,
Handshake SYNACK are used. which means it doesn't
require a handshake.
Broadcasting is not supported by TCP. Broadcasting is supported by
Broadcasting
UDP.
HTTP, HTTPs, FTP, SMTP, and DNS, DHCP, TFTP, SNMP,
Examples
Telnet use TCP. RIP, and VoIP use UDP.