Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

DataSocket: Multiple writers. Still don't get it!

Thanks for the answer Matt, but rely, I still don't get it.

If I make a new item in the DataSocket ServerManger, how and where do I refer to it?

I understand the server must be abel to distinguish between connected activeX components, but where and how inside the ActiveX component do I name this "item" so the server can make out which component has the multible write privilege?

Is the "predifine item" you call "test" the name of the ocx file, the name of the ActiveX project name, the VB control name or the name of the datasocket in the VB code? I have tried it all and more, without a success.

Thanks in advance.
0 Kudos
Message 1 of 4
(3,903 Views)
Actually, what Matt told you is right on the money and I have verified that it works using some of the DataSocket examples that come with ComponentWorks. I'll go ahead and post a couple of links that describe the process again, and then give you a description of how to see it in action.

This is the link Matt posted that describes the proper procedure:

http://ae.natinst.com/operations/ae/public.nsf/fca7838c4500dc10862567a100753500/a8ac9a751404bab18625672400630a3d?OpenDocument

Here is another link talking about DataSocket in LabView, but the same info still applies. Just notice at the end of the last paragraph the author says that "if necessary, restart DataSocket Server for the settings to take effect". Don't pay attention to the "Publisher"/"Subscriber" naming conventions in this doc though because it only applies to LabView.

http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/4ccad3fa329ac282862569a70074a5e4?OpenDocument

Ok, now to try this out yourself you can Open up the DSWriter.vbp project in your MeasurementStudio\VB\samples\datasocket folder, save a copy of it somewhere so that you can run two of them at the same time.

After that open up the DSReader.vbp project so that you can have something that reads what the apps are writing.

Then open up the DataSocket Server Manager, and in the Predefined Data Items area of the list, create a New Item by pressing the button, change the name of the item to wave so it works with your DSWriter apps, check the Allow Multiple Writers checkbox, then make sure that the DefaultWriters for this item is set to everyhost so as not to limit who can write to it.

For final setup of the server, go to the Settings menu and select "Save settings now".

Now try running the applications making them all connect to dstp:///wave, and tada it works. You may have to restart the server for the changes you made in the manager to take effect.

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
Message 2 of 4
(3,903 Views)
Well, thanks for a great answer. Things works now, thanks to you! Though it was realy enough to say "data item" is the "xxx" in the link dstp:///xxx.

I did try that at first, but when it didn't work I got confused and started to try everything else. And after reading all documents I could find, included the links you and Matt gave me (I had found them before), I got frusterated, because it didn't say what "data item" is! And it still dosen't 😉

After setting things correctly up, I did need to restart the server three times to make it work. Yet the connection seems very unstable.

But again, thanks alot.
0 Kudos
Message 4 of 4
(3,903 Views)
Sorry, I didn't answer the rest of your question.

The "data item" is referred to upon connection of your app to the datasocket server. If no predefined data item exists a new one is created, but by default it will not allow multiple writers and cannot be changed. The "data item" name, which in the example I gave you is called "wave", and in Matt's example is called "test", is the actual thing that you refer to the data source by upon connection.

For instance in this code snippet "wave" is the data item name:

CWDataSocket1.ConnectTo "dstp://localhost/wave", cwdsWriteAutoUpdate

In VB once you have connected your CWDataSocket control to a data item in the above manner you can then manipulate it with something like the following:

CWDataSocket1.Data.Value = CVa
r(sinedata)

This changes the "value" of the "data item" that the CWDataSocket control is connected to, and in our case is "wave".

The example code above is taken directly from the DSWriter.vbp project that I mentioned in my other post.

So again, to see this work properly, follow the instructions I gave in the other post.

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
Message 3 of 4
(3,903 Views)