LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Preventing data socket overwrite

If you write to a data socket twice without reading in between is there a way to prevent the data written by the first write from being overwritten. So that when you read from the data socket it will read all of the data which has been written to the data socket since the last read, or allow successive reads of the data socket so that with each successive read the data written the previous time is recovered.
0 Kudos
Message 1 of 4
(3,102 Views)
I attached a modified version of your VI to do what you need. The idea is to attach an item name to the host name (in URL) and you can retrieve the data as many times as you need using that item name. Important is to use different names for your items sent to DS.
The URL format must be "dstp:///".

Hopes this helps
Message 2 of 4
(3,102 Views)
The problem is that I will have one part of labview running and gathering data, and I want to make this data availible via data sockets. However, if I fail to read this data before new data is written to the data socket I do not wish to lose this data. Since there would not really be any way for me to have a different channel for each set of data that is gathered, it is not possible for me to just change the name each time. Is it at all possible to do this, even using a different approach with the data sockets (i was told by someone at ni that data sockets were the best way to do what i'm trying to do)? Thanks.
0 Kudos
Message 3 of 4
(3,102 Views)
Now I understand what you are trying to do ... but it depends on your app specifics. Thus, if you can wait with your Publisher VI until the Reader VI reads the last point, it's easy. Use a boolean (via DS) for handshaking. Make it TRUE before publishing data and FALSE after reading data.
In case you cannot wait, you need to use a buffer via DS. Even for this one you have to decide some limitations in case it's possible to fail Reading data for long time. For this approach, take a look to Buffered DataSocket Examples.
Anyway, if all your processes are running on the same computer, consider using references, glo
bals, LV 2 style globals or even files to share the data.

Good Luck
0 Kudos
Message 4 of 4
(3,102 Views)