Network-Published Shared Variable Appears to Miss Data When Read Quickly After Changing the Value

Updated Jun 15, 2018

Reported In

Software

  • LabVIEW

Issue Details

In my system, I am utilizing a network-published shared variable. I am writing the the variable, and attempt to read from it directly after. Sometimes, the data read from the variable is not equal to the data just written to it. Why does this happen and how can it be fixed?

Solution

Input a wait in your code between writing to the network-published shared variable and reading from it. This will allow the proper time for the new value to be updated correctly. You may need to experiment with the amount of time required between writing and reading.

Alternatively, you can use a Buffered Network-Published Shared Variable or a Network Stream to ensure lossless communication.

Additional Information

Network-published shared variables are not deterministic. There is an inherent delay that occurs between writing a new value to the variable, and when it is updated. If you attempt to read immediately after writing, the new value may not be represented correctly.

WAS THIS ARTICLE HELPFUL?

Not Helpful