Back to blog

Networking · 2026-03-21

TCP vs UDP: How I Remember the Difference

TCP and UDP both move data using ports, but they make different tradeoffs between reliability and speed.

TCP

TCP is connection-oriented. Before data is sent, the client and server establish a connection using a handshake. TCP tracks delivery, orders data correctly, and retransmits missing pieces. That makes it useful for web pages, SSH, email, and file transfers.

The TCP handshake is commonly described as SYN, SYN-ACK, and ACK. This means the client asks to start a connection, the server replies, and the client confirms. After that, the two sides can send data while TCP keeps track of sequence numbers and acknowledgements.

UDP

UDP is connectionless. It sends data without setting up the same reliable session. That makes it faster and simpler, but the application must handle loss if it matters. DNS, video calls, streaming, and some games often use UDP.

UDP does not mean “bad” or “unsafe” by itself. It means the protocol has less overhead. For real-time traffic, a small loss may be better than waiting too long for retransmission. A video call can handle a missed packet better than a large delay.

How I compare them

  • TCP cares more about reliable delivery.
  • UDP cares more about low delay and simple sending.
  • Both use port numbers so traffic reaches the correct service.

Real examples

SSH uses TCP because a remote terminal needs reliable ordered data. If commands or output arrived broken, the session would be frustrating. DNS often uses UDP because a small query and response can be handled quickly. If the response fails, the client can ask again.

Lab idea

Capture DNS traffic and HTTPS traffic in Wireshark. DNS queries commonly show UDP, while HTTPS uses TCP unless newer protocols such as QUIC are involved. Seeing the packets makes the difference easier to remember.

Beginner mistake

I used to think TCP means secure and UDP means insecure. That is not correct. Security depends on other protections too, such as encryption, authentication, and safe configuration.