Computer Science – 14.1 Protocols | e-Consult
14.1 Protocols (1 questions)
TCP (Transmission Control Protocol) is a connection-oriented protocol that provides reliable, ordered, and error-checked delivery of data. It establishes a connection before data transfer, maintains that connection throughout the transfer, and ensures that data is delivered in the correct order and without errors. It uses acknowledgements and retransmissions to achieve reliability. TCP also includes flow control to prevent the sender from overwhelming the receiver.
UDP (User Datagram Protocol) is a connectionless protocol that provides unreliable data delivery. It doesn't establish a connection before data transfer and doesn't guarantee that data will be delivered in the correct order or without errors. It's faster than TCP because it doesn't have the overhead of connection establishment, acknowledgements, and retransmissions.
When to use TCP:
- Reliable data transfer is essential: Applications like web browsing (HTTP), email (SMTP), and file transfer (FTP) require reliable delivery of data. Lossy data would be unacceptable.
- Data integrity is paramount: If data corruption is not acceptable, TCP's error checking and retransmission mechanisms are necessary.
- Ordered delivery is required: When data must be received in the same order it was sent, TCP ensures this.
When to use UDP:
- Speed is more important than reliability: Applications like streaming video, online gaming, and VoIP (Voice over IP) can tolerate some data loss in exchange for lower latency.
- Real-time applications: In real-time applications, it's often better to receive data quickly, even if some packets are lost, than to wait for retransmissions.
- Broadcasting/Multicasting: UDP is well-suited for broadcasting data to multiple recipients simultaneously.