LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to programmatically control a remote VI over a network

I have been using VI server to pass messages between VI's (using invoke nodes or property nodes). This leads sometimes to race conditions and data loss. Having come that far the simplest solution was to add semaphores to prevent multiple VI's accessing the data simultaneously. A better way would be to use queues or notifiers to pass the data directly.
However, if the VI's are running on different computers, this won't work. How can I pass data across the network and still avoid a race condition? The solution should not care whether the data is going across the network or staying on the same computer/instance of Labview- it needs to work either way.

The leading contender seems to be datasocket
. Can anyone tell me the pro's and con's, or recommend a better way? e.g. how long does a datasocket call take? How much processor does it use? Is it going to take up excessive network bandwidth (i.e. loads more than the actual data.) Does the read datasocket VI pause until some data is available, or does it suck up system resources during that time?
Another way would be to have some way of generating an event of some kind over the network, but I can't figure out any way of doing this.
0 Kudos
Message 1 of 3
(2,705 Views)
To communicate between computers datasocket should be fine. It has overhead but can be neglected under most situations. Datasocket will not solve the race condition, the application should handle it.

Pro: easy to use, good for inter application

Con: datasocket server need to be running on each computer, the server may have difficulty to start up (very rarely), it may take some time upon initial connecting.

Hope this helps.

Joe
0 Kudos
Message 2 of 3
(2,705 Views)
Joe,

Thanks. Datasocket seems to be much better than VI server for avoiding a race condition, because the Read Datasocket VI can wait for data to be available- i.e. for another process to write data in. In other words, it can handle a simultaneous read and write call whereas VI server has no way of doing this. So all I need to do is do the reading and writing in an orderly manner and all will (hopefully) be well in the world.

The time delay in sending a message forth and immediately back again (on the particular hardware I am using) is about 20ms, which holds whether I am communicating between two VIs on one computer or on two computers over the network. This is fine for network communication, but for inter-VI comms on the same computer is quite a long
time. Therefore I feel I need two options- either using datasocket or not.

Does anyone know what the time delay is likely to be like if I have multiple data socket connections and they happen to send data at the same time- i.e.how much of the 20ms can happen in multiple thread/processes in parallel and how much happens in serial?

John
0 Kudos
Message 3 of 3
(2,705 Views)