Your IP address:
Provider:
...

TCP vs UDP: transport differences and practical examples

TCP and UDP carry application data over IP, but provide different services. TCP gives applications an ordered byte stream with acknowledgements and retransmission. UDP sends individual datagrams without those transport-level guarantees. Neither choice is automatically better: the application’s requirements decide.

What TCP provides

TCP establishes a connection between endpoints before application data is exchanged. It numbers segments, can retransmit missing data, and delivers bytes to the receiving application in order. Flow and congestion control help prevent a sender from overwhelming the receiver or the network. These properties suit files, email and many web connections. They do not imply encryption: a separate security protocol such as TLS is needed to protect content.

When a segment is lost, the application may have to wait for missing bytes before processing later ones. That is appropriate for a document that must arrive intact, but can add delay to interactive traffic. TCP also does not preserve application message boundaries. Two writes by a sender need not appear as two reads by a receiver; the application must define how its messages are framed.

What UDP leaves to the application

UDP preserves datagram boundaries and does not establish a TCP-style connection. UDP itself does not acknowledge delivery, reorder packets or retransmit missing data. An application built on UDP can still add those features, along with congestion control and encryption, when needed. DNS commonly uses UDP for queries. QUIC runs over UDP yet implements reliable streams and modern security at a higher layer.

For live speech or a game, a very late packet may be less useful than the next timely one. Some applications therefore choose to manage loss and deadlines themselves. Using UDP does not make a congested network fast: queues and drops affect either transport. Measure the actual application rather than assuming the protocol name predicts performance.

Ports and choosing a protocol

Both use port numbers, but TCP port 443 and UDP port 443 identify different endpoints. A TCP port check cannot prove that a UDP service on the same number works. HTTP/1.1 and HTTP/2 normally use TCP with TLS, while HTTP/3 uses QUIC over UDP. When UDP connectivity fails, a client may use a TCP-based HTTP version; the exact result depends on both endpoints.

Start with the application’s needs: complete delivery, order, message boundaries and time limits. Then check network support and security requirements. The specifications for TCP and UDP define their transport services. See the network port guide for the meaning of the numbers.