LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Server Synchronization

Solved!
Go to solution

I currently have a server / multi-client application that I am implementing with VI Server in LabVIEW 8.6.1.  Clients call into the server to execute various VIs to store/retrieve/process data, and the VIs store the data within files as well as function globals, i.e. an uninitialized shift registers within a while loop.  I have a couple questions about this implementation:

 

1.  Are the calls made via VI Server synchronized by VI Server; in other words, without making the VI reentrant myself will VI server ever launch more than one instance of the VI on the server system (I don't want this for obvious reasons)? 

 

2.  I currently use some of the VIs within my server application as static VIs, and also allow others to call into some of them from remote hosts via VI server, and I am concerned about the integrity of the data within my function globals (I've taken the precaution of opening handles to ALL VIs I share with VI Server so they never go out of scope, whether used statically or not).  Is this bad?  If I used only VI server calls within my server app, would this be better (instead of using the "shared" VIs statically)?

 

3.  When a remote client is calling into the server via VI Server, what will happen when the VI is busy?  Does my remote call via a call-by-reference node error out, or does it happily wait its turn until the VI can be accessed (assuming the question to #1 is that only one instance can ever be run).  I don't yet have multiple systems to test race conditions.

 

4.  I am using this VI server implementation between both Mac and Windows systems, is there anything I need to watch out for (besides the obvious pathing issues)?

 

Thanks!

-Danny

0 Kudos
Message 1 of 2
(2,685 Views)
Solution
Accepted by topic author Texas_Diaz

TarantulaDiaz wrote:

 

without making the VI reentrant myself will VI server ever launch more than one instance of the VI on the server system? 


Only if it's a VIT.

 

Also, even if it is reentrant, the VI server will not open multiple copies unless you set the reentrant flag in the OVR options (you can see the exact value in the help for the primitive).

 


If I used only VI server calls within my server app, would this be better?

 


I prefer the static approach for three reasons -

  1. It works around path issues (all you need to do is open the reference by name and it will get it because it's already in memory. If you have a static reference in the caller, you can even use that to get the VI's name, which makes it even safer).
  2. It forces LabVIEW to include the VI in the build (assuming you're building an EXE.
  3. It makes sure the VI stays in memory (which is something you want, since it's a USR glob. I'm not sure what your concern is about the data integrity. Just place the static copy in a section of the code which doesn't execute, but don't use a constant to disable it, or the code could be optimized out).

 


When a remote client is calling into the server via VI Server, what will happen when the VI is busy?...I don't yet have multiple systems to test race conditions.


It waits until it stops running, just like in a normal VI call. Also, you don't need multiple systems for testing. You can simply set different VI server ports for two projects on the same PC and use that for testing.

 


I am using this VI server implementation between both Mac and Windows systems, is there anything I need to watch out for (besides the obvious pathing issues)?


I don't have any experience with that, but you would obviously want to avoid running any VIs which include platform specific code on the other machine (e.g. if you have a VI which uses .NET, you can presumably run it on the Windows machine using VI server with no issues, but don't try running it directly on the Mac).


___________________
Try to take over the world!
Message 2 of 2
(2,663 Views)