| Lesson 3 || TCP and UDP |
| Objective || Define the two transport-layer protocols provided in TCP/IP that allow client/server transactions. |
TCP, UDP and Transport-layer Protocols
What is the difference between the TCP and UDP Protocols?
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are two core transport layer protocols in the Internet Protocol (IP) suite. They are responsible for transmitting data between applications running on different devices in a network. Although both protocols serve the same purpose, they differ significantly in their design and operation:
- Connection-oriented vs. connectionless: TCP is a connection-oriented protocol, meaning it establishes a reliable, virtual connection between two devices before transmitting data. This connection is maintained throughout the data exchange, ensuring that data packets arrive in the correct order and without errors. In contrast, UDP is a connectionless protocol, which means it does not establish a connection before transmitting data. Instead, it sends data packets independently without any guarantee of their arrival or order.
- Reliability: TCP provides reliable data transmission by employing error checking, acknowledgements, and retransmission mechanisms. If a packet is lost or arrives out of order, the receiving end will request retransmission, ensuring that the data is received correctly. UDP, on the other hand, does not guarantee reliable data transmission. It lacks error checking, acknowledgements, and retransmission mechanisms, so lost or out-of-order packets are not retransmitted or reordered.
- Flow control and congestion control: TCP includes flow control and congestion control mechanisms to manage the rate of data transmission and prevent network congestion. It adjusts the transmission rate based on the available bandwidth and the receiver's ability to process incoming data. UDP does not have built-in flow control or congestion control mechanisms, making it potentially less efficient in congested networks or when dealing with varying bandwidth availability.
- Speed: Since UDP does not involve connection establishment, error checking, or flow control, it typically offers faster data transmission than TCP. Applications that prioritize speed and can tolerate data loss or out-of-order delivery often use UDP. TCP, with its additional overhead for reliability and congestion control, is generally slower than UDP but ensures the accurate and complete delivery of data.
- Use cases: TCP is used by applications that require reliable and ordered data transmission, such as web browsing (HTTP/HTTPS), file transfer (FTP), and email (SMTP/POP3/IMAP). UDP is used by applications that prioritize speed and can tolerate some data loss or out-of-order delivery, such as video streaming, online gaming, Voice over IP (VoIP), and Domain Name System (DNS) resolution.
In summary, TCP is a connection-oriented, reliable, and slower protocol suitable for applications that require accurate and complete data transmission. In contrast, UDP is a connectionless, unreliable, and faster protocol suitable for applications that prioritize speed over reliability and can tolerate some data loss or out-of-order delivery.
TCP and UDP
, client/server transactions come in two different kinds.
The first kind of transaction
The first kind is a simple request-reply form. For example, machine A may query the time on machine B, and machine B replies with its idea of the current time.
If, for some reason, machine B fails to respond, or its response is lost, machine A may simply repeat its request after a suitable timeout.
The second kind of transaction
The second kind of client/server transaction requires an ongoing reliable data transfer. For example, a telnet connection requires a reliable stream of data to pass back and forth between the client and the server. An FTP
transaction, used to transfer bulk data files between machines, could not succeed without some way to ensure that the file sent in pieces from machine B to machine A can be reassembled completely at machine A.
Networking your computers dramatically enhances their ability to communicate and most computers (desktops, laptops, servers) are used for communication rather than computation. Many mainframes and supercomputers are busy crunching the numbers for business and science, but the number of these systems in use pales in comparison to the millions of systems busy moving mail to a remote associate or retrieving
information from a remote repository. When you think of the hundreds of millions of desktop systems that are used primarily for preparing documents to communicate ideas from one person to another, it is easy to see why most computers can be viewed as communications devices.
The positive impact of computer communications increases with the number and type of computers that participate in the network.
One of the great benefits of TCP/IP is that it provides interoperable communications between all types of hardware and all kinds of operating systems. The name "TCP/IP" refers to an entire suite of data communications protocols.
The suite gets its name from two of the protocols that belong to it:
- the Transmission Control Protocol (TCP) and
- the Internet Protocol (IP).
TCP/IP is the traditional name for this protocol suite and it is the name used in this course. The TCP/IP protocol suite is also called the Internet Protocol Suite (IPS) and both names are acceptable.
Two transport-layer protocols
TCP/IP provides two transport-layer protocols to allow for the two different types of client/server transactions.
The simple reply-request transactions (such as those required for a DNS
server) use the User Datagram Protocol (UDP)
which provides no guarantee of reliability but which is simple and efficient. Those transactions requiring ongoing reliable data transfer use the (TCP) Transmission Control Protocol, which guarantees that a stream of data sent from one end of a connection to the other can be completely reconstructed in proper order.
A Web server, for example, would require this level of reliability.
TCP/IP is the network protocol suite used by the Internet and most local area networks.
File Transfer Protocol (FTP):
Protocol used to transfer data over a network.
Domain Name Service: resolves domain names to IP addresses
User Datagram Protocol: A connectionless datagram service in the Transport layer used by applications that typically transmit small quantities of data.