In the networking world, communication among different devices is established via a set of rules embedded in to what is known as the protocols. These protocols ascertain how the data transfer takes place among different devices connected within a single network. So basically, protocols are a way that every device uses to communicate with the other devices.
And when it comes to the most predominant protocols in use today, TCP and UDP are responsible for majority of the data transfer:
Transmission Control Protocol or TCP is a more reliable of the two in that it is a connection oriented protocol. What it means is that it establishes a connection using a three way handshake. That is, it first creates a connection, and then acknowledges it to ensure reliability before sending the data. After the data is sent, it terminates the connection to close the three way handshake.
To function efficiently, TCP uses the Internet Protocol, abbreviated as IP. While the TCP transfers the data packets on the network, it is the IP that ensures that data packets reach its correct destination. IP defines address labels that are latched onto the data packets for their secured delivery. Together, TCP/IP forms the backbone of modern information system, including the internet that uses this protocol to transfer information around the globe.
User Datagram Protocol (UDP) on the other hand transfers the data without establishing a secure connection. It simply broadcasts or multicasts the datagrams, more commonly called data packets on to the unsecured network without worrying about acknowledgement, or errors. But it is fast. So UDP is mostly used for applications that require less secured transfers like video streaming, online games, Voice over IP, RIP etc. UDP simply drops the packets that are stuck in the network and redelivers them. And because it doesn’t have to establish security, acknowledgement, or error checking, it has low latency and saves bandwidth. Nevertheless, it is helped by IP and ICMP to manage the errors that occur during data transfer. Hence, UDP only has a single error checking functionality in the form of 2 bytes checksum provided by the IP.
Other major difference among the two protocols is that while UDP drops data packets stuck during the transfer and delivers new ones, TCP recovers and re-transmits the erroneous packets by fixing its errors. This makes TCP a very heavy protocol that is more prone to latency. Yet it is more reliable and secured to be used in modern internet using HTTP/HTTPS, or SSH, NTP, DHCP, DNS, BOOTP, Emails, FTP, VPN, etc. thanks to its outstanding error checking capabilities that allow a systematic flow control and acknowledgement feature while delivering the data.