When to Use UDP Instead of TCP

Updated Dec 11, 2017

Reported In

Software

  • LabVIEW Full
  • LabVIEW Base

Issue Details

When should I use User Datagram Protocol (UDP) instead of Transmission Control Protocol (TCP)?

Solution

The User Datagram Protocol (UDP) is a transport layer protocol for use with the IP network layer protocol. It provides a best-effort datagram service to an end system (IP host). UDP provides no guarantee for delivery and no protection from duplication, but the simplicity of UDP reduces overhead from the protocol and can be adequate for some applications.

A computer may send UDP packets without first establishing a connection to a recipient. The computer completes the appropriate fields in the UDP header (PCI) and forwards the data together with the header for transmission by the IP network layer.

Typically, use UDP in applications where speed is more critical than reliability. For example, it may be better to use UDP in an application sending data from a fast acquisition where it is acceptable to lose some data points. You can also use UDP to broadcast to any machine(s) listening to the server.

In general:
  • TCP is for high-reliability data transmissions
  • UDP is for low-overhead transmissions

Additional Information

In LabVIEW 8.0 or later, refer to the Using LabVIEW with TCP/IP and UDP document in the LabVIEW Help for more information. In LabVIEW 7.1 or earlier, refer to the Using LabVIEW with TCP/IP and UDP Application Note by clicking Help»Search the LabVIEW Bookshelf in LabVIEW for more information.

WAS THIS ARTICLE HELPFUL?

Not Helpful