Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

DataSocket Hangs on Application Exit

Highlighted
I have an application where I am reading from or writing to LabVIEW Shared variables from Measurement Studio's DataSocket Component.  The 3 shared variables are set up as follows
- 2 string variables which buffer 1 string that can be up to 16 Meg Characters long.
- 1 boolean variable
 
In VS.NET 2003, I am creating 3 instances of DataSocket.  1 instance is set to ReadAutoUpdate for one of the string variables, another instance is set to WriteAutoUpdate for the other string variable, and the final one is set to WriteAutoUpdate for the boolean.
 
I noticed that when my application is closed, it is not fully exiting.  I thought this was due to not disposing the DataSocket instances (3) that I created, so I implemented the proper Dispose design pattern to Dispose the DataSockets.  When I do this, the application always hangs when trying to dispose the DataSocket that is set to ReadAutoUpdate on a string.  The other DataSockets disposed fine.  Next, I tried to Disconnect before Disposing the DataSockets, and this time, the Disconnect call on only the one that is set to ReadAutoUpdate hung on Disconnect.  The other 2 DataSockets disconnected and disposed fine.
 
With this setup, I have also noticed that if I have a DataSocket in .NET that both reads and writes one of these 16 meg char string variables, it doesn't quite work right.  It either writes an empty string or does not change the value at all.  However, this problem may be for another discussion.  I've worked around this by having an "In" and "Out" variable.  The boolean tells LabVIEW when it can read its input variable.  So far, this setup is working pretty well.  I just need to get around the disposing/disconnecting issue.
 
Thanks!
0 Kudos
Message 1 of 10
(2,723 Views)
Matt,
 
I'm nut sure what it causing the behavior you are experiencing.  I also have a few questions about your previous post.
 
1. What do you mean when you say that your application is not fully exiting?  Does it hang when it's trying to exit, or do you believe that some memory is being left behind?
2. Are you adding the datasocket control to a form?  If so, you shouldn't need to dispose of it.  It should be disposed of automatically by the form.  Maybe this is why the application is locking up.
3. When you say that your string 16 Meg characters long do you mean it is 16,000,000 characters long?
4. What language are you writing your application in?
 
I wanted to try to replicate your problem here on my computer, but found that I didn't have enough information.  If you could answer my previous questions I think I could help you much better.
 
 
Thanks,
 
Santiago D
0 Kudos
Message 2 of 10
(2,699 Views)

1.  The application hangs when it is trying to exit.
2.  I'm not adding the DataSocket to a form.  I'm creating them at runtime through my code.
3.  The string fields are 16777216 characters long.
4.  c#

Hope this helps!

0 Kudos
Message 3 of 10
(2,695 Views)

Matt,

Thank you for your quick response!  I have one more question.  What version of Measurement Studio are you using?

The latest version of Measurement Studio, 8.0, is the only version that can read from LabVIEW Shared Variables.  The behavior you are experiencing might be due to the version you are using.

 

Thanks,

Santiago D

0 Kudos
Message 4 of 10
(2,670 Views)

Santiago,

I'm using Measurement Studio 8.0, Enterprise Edition (Included in Developer Suite Professional Control Edition)

Thanks,
-Matt

0 Kudos
Message 5 of 10
(2,665 Views)

Matt,

As your code stands right now, are you just creating the three Datasocket instances and reading from the shared variables?  If so, could you post your code so I could test it and see how you are disposing of the datasockets?

 

Regards,

Santiago D

0 Kudos
Message 6 of 10
(2,654 Views)

I have not upgraded to Labview 8, but was wandering what share variables are as I am confused by the statement that this is new for Labview 8 bur data sockets are not new.

I have a Labview FPGA program where the host vi is compiled as a DLL so that I can use it with Visiual Studio.

Now I am wandering if I could do it with these shared vaiables. I must admit that I did not think of data sockets but speed is important.

Thanks

Colin

 

 

 

0 Kudos
Message 7 of 10
(2,645 Views)
In LabVIEW 8, shared variables are a datasocket-like network publishing mechanism where you can share all kinds of data between labview processes and other processes (using DataSocket).  In LabVIEW, they kind of look like Global Variables, so it's easier to program between processes using them.
 
The reason I like using them with Measurement Studio is that they have some neat buffering characteristics.  If the variables are written, you can read the latest value of them using DataSocket, even if you weren't subscribed to them to start off with.  I'm not sure if you can do this with DataSocket alone.
 
-Matt
Message 8 of 10
(2,633 Views)
Santiago,
 
Right now, I'm creating 3 DataSocket instances, writing to 2 of them, and reading from one of them.  The one I'm reading from is the one that locks up...
 
I'll have to see if I can create a test project with this setup to recreate the problem...
 
Thanks,
-Matt
0 Kudos
Message 9 of 10
(2,631 Views)

Thanks Matt.

I will look into it.

Colin

Message Edited by Colin hughes on 01-26-2006 04:05 AM

0 Kudos
Message 10 of 10
(2,607 Views)