LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

vi server exe

Solved!
Go to solution

Hi Experts,

 

It has been some time since I tinkered with VI Server, and cannot seem to do what I want.

 

In a nutshell, I want to be able to access the controls of a VI that will be running in a compiled exe (called watchdog.exe) from another VI, in this case main.vi

 

I have attached a sample zip to show the behaviour.

 

For some reason, I can query the control values of the executable, just cannot seem to set them properly. Am I doing something silly here.

Note: the queried value seems to reflect the correct value, but it is not showing on the front panel of the built app.

 

If I run both main.vi and watchdog.vi from the LV project everything works as expected, but when I run watchdog.exe it does not update the front panel controls.

 

Help!

Thanks

nrp

0 Kudos
Message 1 of 13
(4,437 Views)

NRP,

 

extracting your lvproj reveals an invalid build script for the exe. So i don't know what your exe includes. The most important question: should main.vi run in another application instance than watchdog.vi?

 

Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 13
(4,436 Views)

Odd, I have re-attached the lvproj file.

 

To answer your question, yes eventually there would be two separate .exe files running (no LabVIEW IDE). I figured it was sufficient to have one running as an exe and one from the IDE to prototype the code.

 

Is this going to cause a problem? I know that memory from one exe cannot be shared with another exe, but hoped that VI server could work around this.

 

nrp

0 Kudos
Message 3 of 13
(4,426 Views)

NRP,

 

the problem in your current approach is the following:

The "Open Application Reference" returns the reference to the application instance of your developement environment. Therefore you have no link to your exe at all.

The only possible way to solve this is to use a TCP-communication (you have to pass "localhost" oder "127.0.0.1" to your "Open Application Reference") and to refer to a named service.

I made some tests and to be honest, i think this is unneccessary work. In order to access VIs/EXEs remotely, you can use remote front panels. Please see this KB on more information. 

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 13
(4,418 Views)

Hmm, this is a pity.

 

The example I knocked up is of course trivial, my final app is significantly more complicated with. I don't really want to use Remote Panels with the webserver, in fact in the final version the watchdog.exe would run as a sort of a daemon/service or something similar. 

Can you please attach your example where you used localhost to communicate.

 

Thanks!

nrp

0 Kudos
Message 5 of 13
(4,410 Views)

NRP,

 

i made some further testing and it seems that you cannot access the watchdog via vi server as long as your access is tried in the development environment. Building an exe from the accessing code works if you do the following:

a) Configure your watchdog to be accessable via a certain port. You can do this by right-clicking on "My System" in your Watchdog.lvproj and select Properties. Activate TCP/IP access in the VI Server: Configuration tab. Set up the port or the server name as desired. Please make sure that the port is not blocked by a firewall.

b) Make sure that you enter a '*' in the tabs VI Server: Machine Access and VI Server: Exported VIs. This will grant access from all machines to your application using the selected port and will export all running vis in order to access them.

c) Rebuild the executable. Open the Watchdog.ini which should be rebuild as well. It should include new additional entries similar to:
server.vi.access="+*"
server.tcp.acl="290000000A000000010000001D00000003000000010000002A10000000030000000000010000000000"
server.tcp.enabled=True
server.tcp.port=<YourPort>

d) Create another LV project and include a new VI there. Implement something like this:

 

e) Create an executable of the new VI. No special settings required here. 

f) Close the project Watchdog.lvproj.

g) Run both executables. It should work.

 

Please note that accessing VIs using ActiveX might be a better solution than this.

 

hope this helps,

Norbert 

Message Edited by Norbert B on 05-11-2009 05:03 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 6 of 13
(4,398 Views)

Thanks for your help Norbert B,

 

But I still cannot get it to work.

 

I modified my main VI to include your suggested code, and now have both main.vi and watchdog.vi running as exes. When I run the main.exe I do not get any exported VIs listed or the path filled in.

 

I tried modifying the ini files with various options, but nothing seemed to work. I have left all the default ports etc.

 

Perhaps you can modify my example (re-attached) and see if you can get it to work, I would be most grateful.

 

nrp

 

EDIT: when I build my exes the default ini files are quite different from yours, I am using LV8.6, I dont know why this is so.

Message Edited by nrp on 05-11-2009 12:49 PM
0 Kudos
Message 7 of 13
(4,383 Views)

NRP,

 

in order to get it to work, you have to follow ALL of the steps my previous post comprises. Just inserting some of code of the screenshot does not help....

 

- Your watchdog.ini does not include the needed entries

- You have to connect either a port or a server name to the "Open Application Reference". Otherwise, you will refer to the application instance the very VI runs in (in your case: Main.exe).

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 8 of 13
(4,371 Views)

Norbert,

 

The port is a optional parameter, and defaults to the LV default of 3363, surely as I am not specifying a different port this is not necessary. I do not follow your statement  refer to the application instance the very VI runs in (in your case: Main.exe).

surely the VI server is running in main.exe so this is what we want?

 

I still do not know why your ini parameters are so different from mine when the application is built. What version of LV are you using?

 

Thanks for your continued help though Smiley Happy

Neil

0 Kudos
Message 9 of 13
(4,357 Views)

NRP,

 

i am using LV 8.6.1.

Setting a port is required.

You have two LV applications. If you have the same port for them and try to get the application reference in one of them, Open Application Reference will always return the reference to "it's own application". This is not what you want.

So you need to define different ports for the two applications. In my example, i decided to keep the second exe at the default port. The first (the watchdog) has therefore to be different!

 

Attached you find both exe's with "their" ini-files. If you have LV RTE 8.6 installed, they should work properly.

 

hope this helps,

Norbert

 

PS: The ini-file has to be in the same folder as the equaly named exe. The exe do not need to be placed in the same folder. Play around and move them on disk (with their ini's of course!) 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 10 of 13
(4,351 Views)