Example: DSReader

NI DataSocket

Example: DSReader

Reads values from different data sources using dstp, logos, opc, http, ftp, or file protocols.

Description

Through National Instruments DataSocket technology, your programs can communicate with a variety of different data sources. In this example, you can either manually type a data location for Source or select one of the sources from the listbox.

DataSocket supports the following types of connections:

ProtocolExamples
DataSocket Server ("dstp:")dstp://localhost/wave
dstp://machine/item
Standard Web Server ("http:")http://www.ni.com/cworks/datasocket/tone.wav
Standard FTP Sites ("ftp:")ftp://ftp.ni.com/datasocket/ping.wav
The ftp site should allow anonymous connections.
Lookout/Logos objects ("lookout:" or "logos:")lookout://localhost/testprocess/pot1.value
logos://localhost/testprocess/pot1.value
Files directly accessible from your file system ("file:")file:ping.wav
file:c:/mydata/ping.wav
file://machine/mydata/ping.wav
OLE for Process Control (OPC) Servers ("opc:")opc:/National Instruments.OPCDemo/sine
opc:/National Instruments.OPCDemo/sine?Accesspath=sine
opc://machine/National Instruments.OPCModbus/Modbus Demo Box.4:0
opc://machine/National Instruments.OPCModbus/Modbus Demo Box.4:0?updaterate=100&deadband;=0.7

Controls, Properties, Methods, and Events

This example demonstrates the following controls, properties, methods, and events:

CWDataSocket

ConnectTo, Update, Disconnect, OnDataUpdated, OnStatusUpdated

CWData

Value

Example Location

Samples\DataSocket

See Also

DSReader with Attributes Example

DSWriter Example