Difference between TCP and UDP

Difference between TCP and UDP
Difference between TCP and UDP

TCP and UDP both protocols are used for data transmission from sender to receiver on the internet. There exist some similarities, as well as differences between both of these and both, are used for different purposes and requirements. We will talk more about TCP and UDP protocols and their difference in this article.

What is TCP?

Transmission control protocol or TCP is a connection-oriented protocol which means you need to establish the connection between sender and receiver for data transmission. TCP is the most widely used protocol on the internet and found in the transport layer of the TCP/IP mode. This protocol is highly reliable and it makes sure that ever packets of data is reached at the destination. TCP uses the three-way handshake, flow, error and congestion control. In TCP connection receiver sends feedback everytime to the sender to make sure that every packet is received at the receiver side and it also checks that received packet is errorless and not corrupted. If any packet is lost between or any packet is corrupted then receiver sends a message to the sender to send that packet again and sender sends that packet again and it also makes sure that packets arrive in perfect order to the destination so that TCP is very reliable protocol. But everything has advantages as well as disadvantages and TCP protocol is not an exception. The TCP protocol is slower compare to UDP protocol because it requires time for error checking and feedback from the receiver.

In TCP protocol first connection is established to start communication between sender and receiver. Once a connection is set up, data can be sent bi-directionally from sender to receiver and receiver to sender. For an example, if try access any webpage from your browser then your browser sends TCP packets to the web server, asking for the webpage. Then according to your request, the web server sends packets back to your browser in TCP packets and now you can see that webpage in your browser. Every time you do any activity like login, comment, click a link your browser sends TCP packets to the web server and web server sends data packets to your browser according to the request. But for data communication between the sender and receiver connection must remain live.

What is UDP?

User datagram protocol or UDP is a connection-less protocol. The use of UDP protocol is same as the TCP protocol, to send data from sender to receiver and receiver to sender but in UDP protocol there is no guarantee that all packets will be received at the destination and also no guarantee that packets will arrive in the same order. In this protocol, the sender doesn’t wait for feedback from the receiver that the packet is received or not and error checking is also not available. Because of this nature, UDP is a less-reliable protocol. And packets of information is called Datagram in UDP protocol.

The UDP protocol is used where reliability is not very important and you need faster data transmission. For an example can be used for live streaming of T.V because in live streaming of video sender sends packets but if any packet loss in the way then its no need to send it again. But you use TCP protocol then it sends lost packets again but in live streaming of video, it is not required to get an old packet. So UDP is best for audio and video transmission. UDP protocol is also faster compare to TCP because it doesn’t require feedback from receiver and error checking time is also not required.

Difference between TCP and UDP

Full formTransmission control protocolUser datagram protocol
ConnectionTCP is connection-oriented protocolUDP is connection-less protocol
UsageTCP is suitable for applications that require high reliability and less time critical.UDP is suitable for applications that require less reliability and faster data transmission.
Header sizeHeader size of TCP is 20 Bytes.Header size of UDP is 8 Bytes.
Data lossNo data loss in TCP protocolThere can be data loss in UDP protocol
SpeedData transmission in TCP is slower than UDPData transmission in UDP is faster than TCP
Reliabilityin TCP is very highUDP is less reliable
Error checkingTCP does error checking and error recoveryUDP also does error checking but not error recovery
FieldsSequence number, data offset, reserved, window, urgent pointer, padding, checksum, source port, destination port, options, AcK number, a control bitSource port, destination port, checksum, length
NumberingEvery byte is assigned with a sequence of numbersPackets are not assigned with numbers
HandshakeTCP uses the three-way handshake, SYN, SYN-ACK, ACKThere no handshake ( Connection-less)
WeightTCP is heavy-weightUDP is lightweight
FeedbackTCP requires feedback from the receiver to the sender to make sure that data packet is received perfectly.UDP doesn’t require feedback from the receiver to sender even if any packet loss happens.
Packets orderIn TCP protocol data packets are received in order if packets are not in order then it rearranged.In UDP protocol there is no guarantee that packets are in order. Because in UDP every packet is independent of each other.
ExampleTelephone callslive streaming of video


TCP and UDP both have their advantages and disadvantages. TCP is highly reliable and robust and, on the other hand, UDP is faster and efficient. Where time is important user can use UDP protocol and where reliability is more important than time user can use TCP protocol. Both are very useful protocols for data transmission.

About Geek Kishan

Tech enthusiast | Geek | Programmer | Web developer | Introvert. Love to read and write about technology. I want to share my little knowledge with the world hoping that it will help someone.

View all posts by Geek Kishan →

Leave a Reply

Your email address will not be published. Required fields are marked *