ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using network variables to communicate

Hi People!
 
   Nowadays I'm using DataSocket to send messages between two computers. The application 1 must answer as soon as it receives a question from application 2 and vice-versa, and all works fine (CVI 8.0).
   Now I'm trying to use the Network Variables (CVI 8.1) to do the same thing (using Subscriber and Buffered Writer connections). In the subscriber callback I get the data, process it and must respond as soon as possible, so I think to use CNVPutDataInBuffer to do that. But there is a quote in CVI's Help saying that I can not "write data" inside a Network Variable Callback!
   The questions are: How the application 1 could respond quickly to application 2 (i.e. inside the callback) and what is this "deadlocks" problems?
 
Thanks in advance
Alexandre
 
0 Kudos
Message 1 of 2
(3,578 Views)

If you need to write data to a network variable whenever you get data in a network variable callback, use the PostDeferredCall or PostDeferredCallToThread functions in the Utility library to write data from another thread. The network variable callbacks are called in a dedicated library thread that does not support writing and other operations noted in the documentation. You can see an example of this in samples\3DSim\3DSimReader.c.

0 Kudos
Message 2 of 2
(3,565 Views)