difference between TCP and UDP.
**TCP (Transmission Control Protocol):**
1. **Connection-Oriented:** Establishes a connection before data transfer and ensures reliable, ordered, and error-checked delivery.
2. **Reliability:** Guarantees delivery of data and manages retransmission of lost packets.
3. **Flow Control:** Uses mechanisms to manage data flow and prevent congestion.
4. **Speed:** Generally slower due to overhead from connection management and error checking.
**UDP (User Datagram Protocol):**
1. **Connectionless:** Sends data without establishing a connection or ensuring delivery, making it faster but less reliable.
2. **Reliability:** No guarantee of data delivery, ordering, or error checking.
3. **Flow Control:** Lacks built-in flow control, leading to potential data loss or congestion.
4. **Speed:** Generally faster due to lower overhead and minimal processing.