Junior — Middle
What are the advantages and disadvantages of TCP and UDP protocols, and what are their main differences?
sobes.tech AI
Answer from AI
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are the two main transport protocols in networking.
TCP:
- Reliability: ensures guaranteed delivery, error checking, and packet order.
- Connection establishment: a three-way handshake occurs before data transfer.
- Suitable for applications where data integrity is crucial (e.g., web, email, file transfer).
- Disadvantage — higher latency and overhead due to control and acknowledgments.
UDP:
- No connection establishment, data sent without acknowledgments.
- Faster and with less overhead.
- Does not guarantee delivery, order, or integrity.
- Used in applications where speed is essential and some data loss is acceptable (streaming, gaming, VoIP).
Main differences:
- TCP is connection-oriented, UDP is connectionless.
- TCP guarantees delivery and order, UDP does not.
- TCP is slower but reliable, UDP is faster but less reliable.