DataSocket Library Overview
- Updated2023-02-21
- 3 minute(s) read
toolslib\datasock\dataskt.fp
This library provides programming support for DataSocket. The DataSocket Library functions simplify live data exchange between applications. These functions use the DataSocket server to provide support for data exchange among applications running on different machines on a network. For more information about DataSocket, refer to ni.com/datasocket/, which contains a tutorial, customer solutions, frequently asked questions, and technical information, including the white paper Integrating the Internet into Your Measurement System, DataSocket Technical Overview.
![]() |
Note DataSocket functions have been superseded by the Network Variable Library functions. |
![]() |
Note The DataSocket Library is not supported for 64-bit applications. |
(Linux) The functions in the DataSocket Library are not supported.
DataSocket allows you to read data from multiple types of data sources and allows you to transfer rich data between machines. You can use the DataSocket Library functions to read data from HTTP servers, FTP servers, OPC (OLE for process control) servers, files, and DataSocket Transfer Protocol (DSTP) servers. You also can use the DataSocket Library functions to write data to files and DSTP servers. Although you can use general purpose file I/O functions, TCP/IP functions, and FTP/HTTP requests to transfer data between different applications, applications and files, and different computers, you must write a significant amount of program code to do so. DataSocket greatly simplifies this task by providing a unified API for these low-level communication protocols.
You can specify DataSocket sources and targets (connections) using uniform resource locators (URLs) that adhere to the familiar URL model. For example, to read a file named mydata.dat from an FTP server named ftp.SomeServer.com, you would specify the following URL: ftp://ftp.SomeServer.com/mydata.dat.
The DSTP uses an enhanced data format for exchanging instrumentation style data, including data attributes and the actual data. Data attributes might include information such as an acquisition rate, test operator name, timestamp, quality of data, and so on.
The DataSocket Library also encapsulates information about the data for certain data sources. For example, when you use the DataSocket Library to read from an OPC server, the data includes attributes such as the timestamp and quality of the data.
Use DS_Open to open a connection to a data source or target. DS_Open returns a DSHandle object that you pass to other DataSocket Library functions to read data, write data, and get status information. You also can use the accessMode parameter of this function to update the OPC client/server rate.
Attributes of a data value can have their own subattributes. You can get a DSHandle object for an attribute of a data object so that you can get the data and attribute values of the attribute.
The DSTP server acts as an intermediary between applications writing data and applications reading data. The server can be run on any machine accessible to the applications reading and writing the data. The server is required only when the data is transferred using the DSTP.