Under which condition is TCP preferred over UDP?
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are two common transport layer protocols used in computer networks. Both protocols have different characteristics that make them suitable for specific use cases.
TCP is a connection-oriented protocol that provides reliable and ordered data delivery. TCP establishes a connection between two devices before transmitting data, and it ensures that all data is received correctly and in the correct order. TCP uses acknowledgments and retransmissions to ensure that data is not lost or corrupted during transmission.
UDP, on the other hand, is a connectionless protocol that provides unreliable and unordered data delivery. UDP does not establish a connection before transmitting data, and it does not guarantee that all data will be received or received in the correct order. UDP is often used for real-time applications such as voice and video streaming, online gaming, and DNS queries, where a low-latency, fast data transmission is preferred over data reliability.
To answer the question, under which condition is TCP preferred over UDP, the correct answer is C. TCP is used when data reliability is critical, and UDP is used when missing packets are acceptable.
TCP is preferred over UDP when data integrity and reliability are essential. TCP is commonly used for applications that require the reliable and ordered delivery of data, such as file transfers, email, and web browsing. TCP ensures that all data is received correctly and in the correct order, making it ideal for applications where missing or corrupted data is not acceptable.
UDP is preferred over TCP when low latency is more important than data reliability. UDP is often used for real-time applications such as voice and video streaming, where a small delay or latency can affect the user experience. In these cases, missing or corrupted packets are acceptable because the data is constantly being refreshed and updated.
Therefore, A, B, and D are incorrect answers. UDP is not used when low latency is optimal (A), and TCP is not used when dropped data is more acceptable (B) or when data is highly interactive (D). TCP is always used when data reliability is critical, and UDP is used when missing packets are acceptable.