07-29-2009 01:49 PM
I have a VI that writes to a network shared variable using DataSocket. The DataSocket URL uses PSP. I have another VI that reads the network shared variable also using DataSocket. I am experimenting with data buffering to see when data is lost if the Writer VI writes faster than the Reader VI. Is data buffered using DataSocket with PSP in the URL? If not, I expect data will be lost. If it is buffered, I don't expect data to be lost until the buffer is full or overflows.
Attached is a project with the network shared variables and the Writer and Reader VI. VIs compare reading and writing directly using a shared variable node and using DataSocket. With DataSocket, I am experiencing data loss as if there is no buffering. When using the shared variable node, I do not see data loss. Run the Reader.vi. It will read two network shared variables every two seconds. One variable is read using DataSocket and one is read using a variable node. Next, run the Writer.vi. It will write to two network shared variables every 0.5 seconds. One variable is written using DataSocket and one is written using a variable node. Since the Writer VI is writing four times as fast as the Reader VI data will need to be buffered to avoid data loss. Monitor the Buffered Sequence and BufferedDS Sequence front panel indicators in the Reader VI. Buffered Sequence is data from the variable node. BufferedDS Sequence is data from the DataSocket Read.
Solved! Go to Solution.
07-30-2009 10:49 AM
Hello,
I believe your question is answered in this document:
http://digital.ni.com/public.nsf/allkb/7179F100C803748E862566C1005290FA?OpenDocument
There is no buffering in the DataSocket server and this is reiterated in the link above.
-Zach
07-31-2009 10:45 AM
08-03-2009 10:55 AM
PSP does not change the data buffering. Using the PSP protocol is only guaranteeing that you do not lose the data. Thus, if data is written, it is guaranteed to be received. However, if you overwrite the data before it is read, you will lose the data point in that sense. The key here is that it is lossless transmission. Additional packets being sent to the server will overwrite the data currently on the server in the order in which they are received. Some more information on the PSP protocol can be found in this article:
http://zone.ni.com/devzone/cda/tut/p/id/4679
-Zach