UDP Versus TCP in LabVIEW

Updated Nov 6, 2023

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

Refer to the Using LabVIEW with TCP/IP and UDP help topicĀ for more information.