How Do I Pass a Custom Data Type to DataSocket?Primary Software: LabWindows/CVI Development Systems>>Full Development SystemPrimary Software Version: 5.5 Primary Software Fixed Version: N/A Secondary Software: Other NI Software>>DataSocket
Problem: DataSocket does not support the passing of custom data types, such as structures, within a single data value. It only supports the use of native ActiveX Automation data types. Is there any way to work around this? Solution: One way to pass a custom data type is to create a Variant from your structure and pass it to DataSocket, but this can be tedious to do and it requires the acceptance (i.e., knowledge of the data's structure) of the data type by subscribing applications to the data that you publish. The preferred method for passing a structure would be to send one of the fields in the structure as the main data value and then pass the rest of the fields as attributes of this data value. This will associate the entire structure with a single connection. Obviously this will require more steps than just passing one Variant as the data value does, but it is much easier and it is more portable than packing and sending a Variant for each new data value that you publish. See the related link (below) on using attributes with DataSocket for more information. Related Links: Developer Zone: Using the Attribute Functions to Write Rich Data That Has Attributes Attachments:
Report Date: 05/10/2001 Last Updated: 12/06/2007 Document ID: 299AUIEV |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
