DEV Community

Cover image for Difference between TCP and UDP
Kiran Sethumadhavan
Kiran Sethumadhavan

Posted on • Updated on

Difference between TCP and UDP

Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP) is connection-oriented, meaning once a connection has been established, data can be transmitted in two directions. TCP has built-in systems to check for errors and to guarantee data will be delivered in the order it was sent, making it the perfect protocol for transferring information like still images, data files, and web pages.
But while TCP is instinctively reliable, its feedback mechanisms also result in a larger overhead, translating to greater use of the available bandwidth on your network.

User Datagram Protocol (UDP)
User Datagram Protocol (UDP) is a simpler, connectionless Internet protocol wherein error-checking and recovery services are not required. With UDP, there is no overhead for opening a connection, maintaining a connection, or terminating a connection; data is continuously sent to the recipient, whether or not they receive it.
Although UDP isn’t ideal for sending an email, viewing a webpage, or downloading a file, it is largely preferred for real-time communications like broadcast or multitasks network transmission.

Differences between TCP and UDP

TCP is a connection-oriented protocol, whereas UDP is a connectionless protocol.
The speed for TCP is slower while the speed of UDP is faster.
TCP uses handshake protocols like SYN, SYN-ACK, ACK while UDP uses no handshake protocols.
TCP does error checking and also makes error recovery, on the other hand, UDP performs error checking, but it discards erroneous packets.
TCP has acknowledgment segments, but UDP does not have any acknowledgment segments.
TCP is heavy-weight, and UDP is lightweight.
TCP vs UDP Speed
The reason for UDP’s superior speed over TCP is that its non-existent ‘acknowledgment’ supports a continuous packet stream. Since a TCP connection always acknowledges a set of packets (whether or not the connection is totally reliable), retransmission must occur for every negative acknowledgment where a data packet has been lost.
But because UDP avoids the unnecessary overheads of TCP transport, it’s incredibly efficient in terms of bandwidth, and much less demanding of poor-performing networks, as well.

Do you want to Kick-start a career in Cyber Security and want to know how hackers hack in real life ☠️☠️

Join Now and support !!!
250+ Members already Joined

Top comments (0)