DataSocket Functions and Variant Data
- Updated2026-05-01
- 2 minute(s) read
The DataSocket Read function reads incoming live data as variant data by default.
Using variant data for live data communication allows you process data without needing to know the exact data type. This is useful for programmatically reading complicated data and reading data from an unfamiliar source, such as a different application.
You can cast this variant data to a specific type while reading it or after reading it using the Variant to Data function. If your variant data contains attributes, cast the data to a specific type after reading it so you can extract the attributes.
Adding and Reading Attributes in Live Variant Data
You can use the To Variant function to convert the data you write to a data connection to variant data programmatically.
The following block diagram continuously acquires a temperature reading, converts the data to variant data, and adds a time stamp as an attribute to the data.

When another VI reads the live data, the VI must convert the variant data to a data type it can manipulate. The following block diagram continually reads temperature data, converts the variant data into a temperature reading, retrieves the time stamp attribute associated with each reading, and displays the temperature and the time stamp on the front panel.

Related Information
- Variant Data
- DataSocket Read Function - LabVIEW Programming Reference Manual
- To Variant Function - LabVIEW Programming Reference Manual
- Set Variant Attribute Function - LabVIEW Programming Reference Manual
- Variant to Data Function - LabVIEW Programming Reference Manual
- Adding Attributes to Variant Data
Add attributes to variant data in LabVIEW by using the Set Variant Attribute function with a name-value pair.
- Retrieving Attributes from Variant Data