LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Datasockets malfunctions when one of the VIs is compiled into an EXE

I have a strange problem to report about Datasockets. The following simple test works fine when both reader and writer are VIs... but refuse to work when one is compiled to an EXE. Here is the situation:

I have a simple Datasocket reader VI that sits in a loop. It reads a URL (with a 10s timeout) and then waits 10 seconds and then reads the URL again... over and over. The URL is on the localhost and the datatype is a simple integer.

I also have a simple Datasocket writer VI that writes an integer to this URL once and then stops.

If I run the Reader VI, it will sit in a loop and read the URL over and over. If I run the Writer VI, it updates the URL once and the Reader will correctly read the integer.

This works fine in LabVIEW... but if I compile any one of the VIs (or both) into an EXE and run it, then they refuse to communicate properly. I have attached example VIs and executables that can easily reproduce this problem. Here is are detailed instructions to reproduce the problem:

1. Open "DS Reader.vi" and run it inside LabVIEW. Note how it will continually timeout because nothing has been written to the URL.

2. Open "DS Writer.vi". Wait until the the DS Reader displays the "Waiting 10 seconds" text and then run "DS Writer.vi". It will write an integer to the URL.

3. Notice how the "DS Reader.vi" will then read this integer. This is fine.

4. Let "DS Reader.vi" continue to run. You will notice that subsequent iteration will timeout because the URL has not been updated.

5. Wait until the the DS Reader displays the "Waiting 5 seconds" text again and then double-click on "DS Write.exe". It will open and run and write an integer to the URL just as the VI did previously. However, you will now notice that the "DS Reader.vi" does NOT receive the update. In fact, it never receives any updates.

Am I misunderstanding the logic of how datasockets works? Or am I doing something totally wrong? Can someone out there confirm this behaviour?
http://www.medicollector.com
0 Kudos
Message 1 of 3
(2,609 Views)
Hello, John! I was able to reproduce this behaviour. Try reorganize your DS Writer.vi with loop. When DS Writer continuously running, then this exe have no problem. I think, that problem occured during connection to DataSocket Server when executable file starting.
See attached files.
Download All
Message 2 of 3
(2,608 Views)
Thanks, Andrey. This works.

This behaviour is very strange. The way it works, it would lead you to believe that the writer VI must be running for reader to read the URL... but this not the case. I tried changing the writer to use a sequence loop that first waited a few seconds, wrote to the URL, and then waited another 10 seconds... but the reader still couldn't read the URL.

Hmm... whatever the case, I can use your technique for a work-around solution. Thanks!
http://www.medicollector.com
0 Kudos
Message 3 of 3
(2,608 Views)