|Transmission control protocol (TCP)||User datagram protocol (UDP)|
|TCP is a connection-oriented protocol. Connection-orientation means that the communicating devices should establish a connection before transmitting data and should close the connection after transmitting the data.||UDP is the Datagram oriented protocol. This is because there is no overhead for opening a connection, maintaining a connection, and terminating a connection. UDP is efficient for broadcast and multicast type of network transmission.|
|TCP is reliable as it guarantees delivery of data to the destination router.||The delivery of data to the destination cannot be guaranteed in UDP.|
|TCP provides extensive error checking mechanisms. It is because it provides flow control and acknowledgment of data.||UDP has only the basic error checking mechanism using checksums.|
|Sequencing of data is a feature of Transmission Control Protocol (TCP). this means that packets arrive in-order at the receiver.||There is no sequencing of data in UDP. If ordering is required, it has to be managed by the application layer.|
|TCP is comparatively slower than UDP.||UDP is faster, simpler and more efficient than TCP.|
|Retransmission of lost packets is possible in TCP, but not in UDP.||There is no retransmission of lost packets in User Datagram Protocol (UDP).|
|TCP has a (20-80) bytes variable length header.||UDP has a 8 bytes fixed length header.|
|TCP is heavy-weight.||UDP is lightweight.|
|TCP doesn’t supports Broadcasting.||UDP supports Broadcasting.|
|TCP is used by HTTP, HTTPs, FTP, SMTP and Telnet.||UDP is used by DNS, DHCP, TFTP, SNMP, RIP, and VoIP.|
A short example to understand the differences clearly :
Suppose there are two houses, H1 and H2 and a letter have to be sent from H1 to H2. But there is a river in between those two houses. Now how can we send the letter?
Solution 1: Make a bridge over the river and then it can it delivered.
Solution 2: Get it delivered through a pigeon.
Consider the first solution as TCP. A connection has to made ( bridge ) to get the data (letter) delivered.
The data is reliable because it will directly reach to another end without loss in data or error.
And the second solution is UDP. No connection is required for sending the data.
The process is fast as compare to TCP, where we need to set up connection(bridge). But the data is not reliable: we don’t know whether the pigeon will go in the right direction, or it will drop the letter on the way or some issue is encountered in mid-travel.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Differences between JDK, JRE and JVM
- Differences between Web Services and Web API
- What are the differences between C and Embedded C?
- Similarities and Differences between Ruby and C++
- Differences between IPv4 and IPv6
- Differences between Data paths
- Differences between POP3 and IMAP
- Differences between Bootstrap and JQuery UI
- Differences between Testing and Debugging
- Differences Between Excel and Tableau
- Differences between RIPv1 and RIPv2
- What are the differences between HTTP, FTP, and SMTP?
- Differences between Synchronous and Asynchronous Counter
- Differences between Associative and Cache Memory
- Differences Between MATLAB and R Programming Language
- Differences between RGB and CMYK color schemes
- Differences between 8086 and 8088 microprocessors
- Differences between Classical and Quantum Cryptography
- Differences between Interface and Class in Java
- Differences between Synthesized and Inherited Attributes
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.