TCP vs UDP | What is the basic difference between TCP and UDP protocols ?
Before we proceed further, we would like to see an example. Suppose you are watching a cricket live match of India and England on your desktop computer and at the same time the power goes out in your house and your computer shuts down for 10 minutes. After 10 minutes, as soon as the power comes on, you turn on your computer and start watching the match.
Friends, you will notice that there is a change in the score of the time during which the computer was turned off and the score of the time when the computer was turned on. Meaning if the computer was off for 10 minutes then you could not watch the live broadcast of the match for that time while the match was being broadcast live from the cricket ground. Meaning your network was broadcasting data continuously.
Let’s see another example –
You were downloading some songs or videos file on your computer from your FTP server and then your computer’s electricity goes away which means your computer shuts down. And the data you were downloading stops. As soon as the computer is turned on, you have to apply all the data again for download.
Friends, this is because the UDP protocol was being used for the live broadcast of cricket while the TCP protocol was being used to download the data from the server.
Let us read further in details –
First of all, I would like to tell you the full form of TCP and UDP –
TCP stands for Transfer Control Protocol
UDP stands for User Datagram Protocol
- Connection Oriented: – Means whenever TCP will transmit data, it will create a connection before transmitting. And the transfer of data will happen only after the connection is created. That’s why TCP is called Connection Oriented Protocol.
- Reliable :- Since TCP creates the connection only after that the transfer of data starts. This means that TCP is reliable and there is also a guarantee of reaching the data.
- Error Control :- Error control is mandatory in TCP. It keeps checking through error of checksum.
- Slow Data Transmission :- Slow transmission does not mean that it is very slow. It is definitely a bit slow compared to UDP. But it’s hard to detect for Human Bing. Meaning there is a difference of nanoseconds. This happens because as soon as data is received from the application layer, TCP creates the connection and only then starts the transmission of data. While the connection is not created in UDP .
- More Overhead :- TCP use 20 to 60 byte overhead while transferring data. Overhead means the head that is incurred before transferring the data.
- Flow Control :- Flow control means that what is the capacity to accept the data of whom TCP are transferring data and what is the capacity of the network used between them. TCP uses algorithms to manage flow control.
- Data Retransmission :- If there is a loss of data, TCP it transfers the data again. There is a system of acknowledgment in TCP. So if there is no acknowledgment of a data chunk then TCP resends that data chunk.
- TCP Application Use :- HTTP , FTP , HTTPS
- Connectionless :- UDP is connectionless. Like TCP, does not create any kind of connection. As soon as it receives the data, it starts transferring the data immediately. That’s why UDP is called connectionless.
- Less Reliable :- It is less reliable as there is no guarantee that the data will reach.
- No Error Control :- Error control is optional in UDP. there is no any option like checksum . it is not able to monitoring errors.
- Fast Data Transmission :- UDP is fast as compare to TCP. Because UDP does not create any kind of connection while transferring data.
- Less Overhead :- UDP use only 8 Byte overhead .
- No Flow Control :- There is no any control over flow of data.
- No Data Retransmission :- There is no such system that the data should be sent again in case of data loss. There is a no any system of acknowledgment in UDP.
- UDP Application Use :- DNS , DHCP , BOOTP , RIP ( Routing Information Protocol)