LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lock Out of Software

I want to make sure that no more than one instance of a LabView software code is running at a time. For example the software will reside on several computers, but if one copy is running I don't want a second copy to run and cause problems.
 
Any ideas?
 
Thanks
0 Kudos
Message 1 of 2
(2,569 Views)
Are you dealing with some sort of resource conflict? Are you trying to prevent the application from starting in the first place, or is it ok for it to initially start, check to see if it's ok to go, and then go, otherwise error out? If the latter, there's number of ways you can do this.

One way is to use a network-published shared variable that acts as a flag. The first app that runs would set the variable, and other apps would see that the flag is already set, so they can't run. Somewhat crude, but it should work. Note that shared variables are supported on Windows platforms only.

A more general approach is to use TCP/IP with a pre-defined port. When your app starts up it turns on its TCP/IP connection listening process. When the application starts upon another PC it can try to connect to the application running on one of the other PCs. If the connection is successful, it knows the application is running. More general, but this requires that each computer have a list of PCs where the application can run.

Yet another way if you have a file server that all PCs can see is to create a "lock file" (just an empty text file) when the application starts up. Any other application that tries to start will see the lock file already exists, and won't run.

As you can see, there are various ways to do this, and I'm sure others can suggest more.
0 Kudos
Message 2 of 2
(2,559 Views)