LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data socket. What do I need to do to make this work?

Solved!
Go to solution
Attached are two simple examples of what I want to do.  I need to have two seperate programs running on one computer sharing a ds connection and passing data back and forth.  The examples don't work because the programs over write the ds data before the other has a chance to read.  I've tried a couple of different mutations of the programs to no avail. I need to know what I have to do to accomplish the desired result.
Download All
0 Kudos
Message 1 of 5
(3,871 Views)

Hi Mike,

 

By defualt a DataSocket will be configured at a "single point" variable, meaning the array you are passing will continually be overwritten. There are a couple methods for avoiding this problem:

 

1. Does your application require Datasocket communication? Or, could you employ a global shared variable with buffering to pass the array data between VIs?

 

2. Configuring a server-side buffer would essentially enable buffering on the DataSocket element, a link to more information on the DataSocket configuration is given below:

 

Configuring a DataSocket Server
http://zone.ni.com/devzone/cda/tut/p/id/3123#toc0

Missing Data Points Using DataSocket Buffering
http://digital.ni.com/public.nsf/allkb/4A5530CF1D725ED586256D19008248C1?OpenDocument

 ThankYou,

 

PCorcs

 

 

 

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

0 Kudos
Message 2 of 5
(3,845 Views)
The programs will be compiled so global variables won't work.  I obviously lack some background knowledge because not much of what you referred me to made much sense.Smiley Sad  However, I re-did the programs using predefined variables in the ds server manager.  One for the scan program to write the array and another to read the boolean and the reverse for the read program.  I point to the appropriate variable target when I read/write the desired information.  This seems to work (not sure why) but is this a correct at all or is this just something that's going to work in my examples and might not work in a real world application?  Thanks for your help.
Message Edited by Mike Weber on 02-15-2010 10:13 PM
Download All
0 Kudos
Message 3 of 5
(3,822 Views)
Solution
Accepted by topic author Mike_Weber

Mike,

 

I 'm not sure what you mean by, "The programs will be compiled so global variables won't work." If you are referring to an executable application, you may build LabVIEW applications that host network shared variables just like VI's in the development environment. Like the devlopment environment, the Distributed System Manager must be deployed to the target machine; as well as, the LabVIEW Run-Time engine.

Using the LabVIEW Shared Variable
http://zone.ni.com/devzone/cda/tut/p/id/4679

How Do I Deploy Network Shared Variables from a Compiled Executable?
http://digital.ni.com/public.nsf/websearch/04D9A85B6967EE87862571140065EEC6?OpenDocument

 

In so far as your second set of example VIs, the code seems correct; however, you are opening a Data Socket reference inside a While Loop in the 'Scan' VI. I may reccomend initializing the reference outside the loop, as you did with the boolean value. 

 

Thanks,

 

PCorcs

 

 

 

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

Message 4 of 5
(3,795 Views)
Evidently my trove of mis-information know no boundsSmiley Sad  I had written a previous application for the lab and having the problem then was told shared variables would not work in an exe.  Perhaps I just misunderstood.  Anyway I'll take a gander at the links you provided and hope they make some sense to me.  My version is 8.5 but at the time I had ask the question it may have been 8.0.  Guess I was in a hurry when I put that reference init in a loop. Thanks for your help. 
0 Kudos
Message 5 of 5
(3,783 Views)