Guide to Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)
TCP and UDP are important because they are fundamental protocols used in the transfer of data across the internet.
What is TCP and UDP?
Both TCP and UDP are protocols used for sending bits of data—known as packets—over the Internet. They both build on top of the Internet Protocol (IP). However, they work differently and are used for different purposes.
Transmission Control Protocol (TCP) is a connection-oriented protocol, which means a connection is established and maintained until the application programs at each end have finished exchanging messages. It determines how to break application data into packets that networks can deliver, sends packets to and accepts packets from the network layer, manages flow control, and—because it is meant to provide error-free data transmission—handles retransmission of dropped or garbled packets as well as acknowledgement of all packets that arrive.
User Datagram Protocol (UDP) is a simpler, connectionless Internet protocol. Multiple messages are sent as packets in chunks using UDP.
How TCP and UDP Works
In TCP, messages are sent and received after connection is established between the sender and receiver. UDP is a simple transport-layer protocol, connectionless, and does not guarantee delivery by itself.
Exam Tips: Answering Questions on TCP and UDP
1. Understand the key differences between TCP and UDP. TCP is a connection-oriented protocol and it requires data to be consistent at the destination, while UDP does not require such strict packet delivery.
2. TCP is more reliable since it takes time to establish the connection but ensures delivery of packets, while UDP is faster as it doesn’t have to establish a connection and does not ensure delivery.
3. In terms of services or applications, remember that TCP is used by services that require all information to be sent and arrived, like web servers, email, FTP. On the other hand, UDP is used for services that require fast transmission, like VoIP, DNS, DHCP.
4. In questions asking about reliability, speed, ordering, connection setup remember TCP offers these features whereas UDP does not. But in questions about resource usage and simplicity UDP is the correct answer as it does not provide these features and thus consumes less resources and is simple.