Tcp uses a checksum to prevent data corruption, while no checksum is present in udp
What is User Datagram Protocol (UDP)?User Datagram Protocol (UDP) is a communications protocol that is primarily used to establish low-latency and loss-tolerating connections between applications on the internet. Show UDP speeds up transmissions by enabling the transfer of data before an agreement is provided by the receiving party. As a result, UDP is beneficial in time-sensitive communications, including voice over IP (VoIP), domain name system (DNS) lookup, and video or audio playback. UDP is an alternative to Transmission Control Protocol (TCP). Both UDP and TCP run on top of IP and are sometimes referred to as UDP/IP or TCP/IP. However, there are important differences between the two. For example, UDP enables process-to-process communication, while TCP supports host-to-host communication. TCP sends individual packets and is considered a reliable transport medium. On the other hand, UDP sends messages, called datagrams, and is considered a best-effort mode of communications. This means UDP doesn't provide any guarantees that the data will be delivered or offer special features to retransmit lost or corrupted messages. UDP provides two services not provided by the IP layer. It provides port numbers to help distinguish different user requests. It also provides an optional checksum capability to verify that the data arrived intact. User Datagram Protocol featuresUser Datagram Protocol has attributes that make it beneficial for use with applications that can tolerate lost data. Below are some examples:
UDP header compositionUDP uses headers when packaging message data to transfer over network connections. UDP headers contain a set of parameters -- called fields -- defined by the technical specifications of the protocol. The User Datagram Protocol header has four fields, each of which is 2 bytes. They are the following:
How UDP worksUDP uses IP to get a datagram from one computer to another. UDP works by gathering data in a UDP packet and adding its own header information to the packet. This data consists of the source and destination ports on which to communicate, the packet length and a checksum. After UDP packets are encapsulated in an IP packet, they're sent off to their destinations. Unlike TCP, UDP doesn't guarantee the packets will get to the right destinations. This means UDP doesn't connect to the receiving computer directly, which TCP does. Rather, it sends the data out and relies on the devices in between the sending and receiving computers to correctly get the data where it's supposed to go. Most applications wait for any replies they expect to receive as a result of packets sent using UDP. If an application doesn't receive a reply within a certain time frame, the application sends the packet again, or it stops trying. UDP uses a simple transmission model that doesn't include handshaking dialogues to provide reliability, ordering or data integrity. Consequently, UDP's service is unreliable. Packets may arrive out of order, appear to have duplicates or disappear without warning. Although this transmission method doesn't guarantee that the data being sent will reach its destination, it does have low overhead and is popular for services that don't absolutely have to work the first time. Applications of UDPLossless data transmissionUDP can be used in applications that require lossless data transmission. For example, an application that is configured to manage the process of retransmitting lost packets and correctly arrange received packets might use UDP. This approach can help to improve the data transfer rate of large files compared to TCP. In the Open Systems Interconnection (OSI) communication model, UDP is in Layer 4, the transport layer. UDP works in conjunction with higher-level protocols to help manage data transmission services, including Trivial File Transfer Protocol (TFTP), Real Time Streaming Protocol (RTSP) and Simple Network Management Protocol (SNMP). Gaming, voice and videoUDP is an ideal protocol for network applications in which perceived latency is critical, such as in gaming, voice and video communications. These examples can suffer some data loss without adversely affecting perceived quality. In some cases, however, forward error correction techniques are used in addition to UDP to improve audio and video quality, despite some loss. Services that don't need fixed packet transmissionUDP can also be used for applications that depend on the reliable exchange of information but should have their own methods to answer packets. These services are advantageous because they're not bound to fixed patterns to guarantee the completeness and correctness of the data packets sent. Users can decide how and when to respond to information that's not correct or sorted. Multicasting and routing update protocolsUDP can also be used for multicasting because it supports packet switching. In addition, UDP is used for some routing update protocols, such as Routing Information Protocol (RIP). Fast applicationsUDP can be used in applications where speed rather than reliability is critical. For instance, it might be prudent to use UDP in an application sending data from a fast acquisition where it's OK to lose some data points. TCP vs. UDPTCP and UDP are part of the TCP/IP protocol suite, which includes a number of protocols for carrying out network communications. Compare some of the main differences between TCP and UDP.TCP has emerged as the dominant protocol used for the bulk of internet connectivity due to its ability to break large data sets into individual packets, check for and resend lost packets, and reassemble packets in the correct sequence. But these additional services come at a cost in terms of additional data overhead and latency. In contrast, UDP is considered a connectionless protocol because it doesn't require a virtual circuit to be established before any data transfer occurs. The communication protocol just sends the packets, which means it has much lower bandwidth overhead and latency. With UDP, packets may take different paths between sender and receiver. As a result, some packets may be lost or received out of order. UDP characteristics include the following:
TCP characteristics include the following:
This was last updated in October 2021 Continue Reading About User Datagram Protocol (UDP)
Dig Deeper on Network Infrastructure
Does TCP and UDP use checksum?TCP checksums are identical to UDP checksums, with the exception that checksums are mandatory with TCP (instead of being optional, as they are with UDP). Furthermore, their usage is mandatory for both the sending and receiving systems.
Does UDP have a checksum?UDP uses a simple connectionless communication model with a minimum of protocol mechanisms. UDP provides checksums for data integrity, and port numbers for addressing different functions at the source and destination of the datagram.
Does TCP use checksum?Introduction. Checksum is a simple error detection mechanism to determine the integrity of the data transmitted over a network. Communication protocols like TCP/IP/UDP implement this scheme in order to determine whether the received data is corrupted along the network.
Why is there checksum in UDP when UDP does not ensure error free delivery?If only a single bit swaps, the UDP packets may have an incorrect destination port. So they added a checksum which ensures that neither the UDP header nor the data payload has been corrupted but made it optional, so it's up to you whether you want to use it or not.
|