01-28-2025 09:55 AM
Hi,
I am trying to replace the datasocket vi from an old version of labview with the datasocket vi from LV2015 without having to change my input variables. The VI that currently exists in my code is this one
And I am trying to replace it with this:
But I dont know how I should modify the DataSocket Reference In wire such that it becomes compatible with this one. Could anybody help me with this? The datasocket reference in is a 1d array of clusters containing the following elements:
01-28-2025 04:52 PM - edited 01-28-2025 04:53 PM
My DataSocket is a little rusty.
Here is the old and new style of setting up DataSocket.
The old style required you to create a DS reference, connect it to a URL and then you could read it.
With the new style you can open a connection with the URL and then use that reference to read OR you can wire the URL directly into the read. I believe using the connection reference is faster if you are reading/writing the item often.
Unfortunately, the DS references inside the old DS Reference cluster are not the type of reference the new style is looking for. But you can use that reference to get the URL. Then you can use that URL to open a new style reference.
Obviously it would be better to just replace the old-style DS Create and DS Connect with the new DS Open, but if you are stuck with the old style references for some reason, you can get the URL and then DS Open with that.
01-29-2025 01:37 AM
Ok thanks, I will try that out.
And to write the data do I just wire in the values for the data and attribute to two separate VIs like this?
Given that the outdated datasocket write VI looks like this:
01-29-2025 01:19 PM
I don't think the new interface supports attributes.
NI has a page here: DataSocket Functions and Variant Data - NI that writes to DS as a variant. You can add attributes to variants if you need. But in my opinion this isn't a great solution. First, you always need to cast from variant to read the data. Second, every time you want to update the data or any attributes you need to write everything. In other words, if you create a variant with a data value, add some attributes and then write a new data value the attributes will be gone because they were attached to the initial variant, not the DataSocket. See example below.