Junior
What is the difference between TCP and UDP protocols?
sobes.tech AI
Answer from AI
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are transport layer protocols with different characteristics:
-
TCP is connection-oriented. A connection is established between sender and receiver before data transfer. TCP guarantees delivery, order, and integrity of data. If a packet is lost, it will be retransmitted. This makes TCP reliable but slower.
-
UDP is connectionless. Packets (datagrams) are sent without acknowledgment. There is no guarantee that data will arrive or arrive in order. UDP is faster and simpler, suitable for applications where speed is critical and some data loss is acceptable (e.g., streaming video, gaming).
In summary:
- TCP: reliability, error checking, order, connection setup.
- UDP: minimal delay, no delivery guarantee, simplicity.
The choice depends on application requirements.