How do TCP and UDP differ in the way that they establish a connection between two endpoints?
The correct answer is A: TCP uses the three-way handshake, and UDP does not guarantee message delivery.
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are both transport layer protocols used in computer networks. TCP is a connection-oriented protocol, while UDP is connectionless.
TCP uses a three-way handshake to establish a connection between two endpoints. The three-way handshake is a process of exchanging three packets between the sender and the receiver before the data transmission starts. The three packets are:
SYN (synchronize): The sender sends a SYN packet to the receiver to initiate the connection.
SYN-ACK (synchronize-acknowledge): The receiver responds with a SYN-ACK packet, which acknowledges the receipt of the SYN packet and sends its own SYN packet to the sender.
ACK (acknowledge): The sender responds with an ACK packet, which acknowledges the receipt of the SYN-ACK packet.
Once the three-way handshake is completed, the data transmission can begin. TCP ensures the reliability of data transmission by using error detection, retransmission, and flow control mechanisms.
On the other hand, UDP is a connectionless protocol that does not guarantee message delivery. UDP packets are sent without establishing a connection between the sender and the receiver. UDP is used in situations where the loss of some data is acceptable, such as streaming video or audio, where a lost packet can simply be skipped over.
UDP does not use the three-way handshake or any other connection establishment mechanism. Instead, UDP packets are simply sent from the sender to the receiver, without any confirmation or acknowledgment from the receiver. As a result, UDP is faster and more efficient than TCP, but it is also less reliable.
In summary, TCP uses the three-way handshake to establish a connection between two endpoints and provides reliable data transmission, while UDP is a connectionless protocol that does not guarantee message delivery.