TCP and UDP

2 min read

Authors
banner

Table of Contents

TCP

Transmission Control Protocol (TCP) is connection-oriented, meaning once a connection has been established, data can be transmitted in both 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.

tcp

But while TCP is instinctively reliable, its feedback mechanisms also result in a larger overhead, translating to greater use of the available bandwidth on the network.

UDP

User Datagram Protocol (UDP) is a simpler, connectionless internet protocol in which 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.

udp

It is largely preferred for real-time communications like broadcast or multicast network transmission. We should use UDP over TCP when we need the lowest latency and late data is worse than the loss of data.

TCP vs UDP

TCP is a connection-oriented protocol, whereas UDP is a connectionless protocol. A key difference between TCP and UDP is speed, as TCP is comparatively slower than UDP. Overall, UDP is a much faster, simpler, and more efficient protocol, however, retransmission of lost data packets is only possible with TCP.

TCP provides ordered delivery of data from user to server (and vice versa), whereas UDP is not dedicated to end-to-end communications, nor does it check the readiness of the receiver.

FeatureTCPUDP
ConnectionRequires an established connectionConnectionless protocol
Guaranteed deliveryCan guarantee delivery of dataCannot guarantee delivery of data
Re-transmissionRe-transmission of lost packets is possibleNo re-transmission of lost packets
SpeedSlower than UDPFaster than TCP
BroadcastingDoes not support broadcastingSupports broadcasting
Use casesHTTPS, HTTP, SMTP, POP, FTP, etcVideo streaming, DNS, VoIP, etc
© 2024 Karan Pratap Singh