Junior
What is the difference between TCP and UDP protocols?
sobes.tech AI
Answer from AI
| Feature | TCP | UDP |
|---|---|---|
| Connection Type | Connection-oriented (establishes a connection) | Connectionless (does not establish a connection) |
| Reliability | High (guaranteed delivery, packet order) | Low (no delivery guarantee, order not guaranteed) |
| Control Mechanisms | Flow control, error control, acknowledgment (ACK) | None |
| Speed | Lower | Higher |
| Header Size | 20 bytes (minimum) | 8 bytes |
| Usage | Data transfer requiring reliability (HTTP, FTP, SMTP) | Data transfer requiring high speed (streaming video/audio, online gaming, DNS) |
TCP establishes a connection, guarantees data delivery, order, and error control. This involves additional mechanisms and exchange of control information, making it slower. UDP is a simpler and faster protocol without connection establishment and delivery guarantees, suitable for delay-sensitive applications where losing a single packet is not critical.