08-30-2019 01:22 PM
I have searched and from the documentation I have read I should be able to send a strict typedef cluster through a network stream, however I am unable to get it to work. when I wire the strict typedef to the Create network stream writer (or reader) endpoint I get broken wires with a polymorphic terminal cannot accept this data type" message. I am running on a cRIO, but from what I understand this shouldn't be an issue either.
I can convert to a variant and create the endpoints, but then when I try to convert the variant back into the cluster I get an error 91.
Any help is greatly appreciated, thanks!
Solved! Go to Solution.
08-30-2019 01:32 PM
You need to get rid of the references in the type def. This includes the DAQmx Task, Occurance, and File references. That does make sense. Your other application/machine cannot use them anyways.
08-30-2019 01:34 PM
@adekruif wrote:
...
I can convert to a variant and create the endpoints, but then when I try to convert the variant back into the cluster I get an error 91.
Any help is greatly appreciated, thanks!
if you try to convert an empty variant back to anything you will get an error 91.
So that suggests the variant is empty.
Ensure the variant that is sent is valid or check for the error 91 as an indication that you did not get anything.
Ben
08-30-2019 01:39 PM
@crossrulz wrote:
You need to get rid of the references in the type def. This includes the DAQmx Task, Occurance, and File references. That does make sense. Your other application/machine cannot use them anyways.
The type def can still be used provided the references are not used anywhere but the process context in which they were created ( i.e RT only use).
Ben
08-30-2019 01:56 PM
@crossrulz wrote:
You need to get rid of the references in the type def. This includes the DAQmx Task, Occurance, and File references. That does make sense. Your other application/machine cannot use them anyways.
Ok, that makes sense. Would have been helpful if that was in the documentation somewhere for noob's like me.
@Ben wrote:
@crossrulz wrote:
You need to get rid of the references in the type def. This includes the DAQmx Task, Occurance, and File references. That does make sense. Your other application/machine cannot use them anyways.
The type def can still be used provided the references are not used anywhere but the process context in which they were created ( i.e RT only use).
Ben
I won't be using any of the references on the PC side, only the RT side. If I understand correctly, I should be able to use the typedef with references and get it to work. Do I have to go through a variant data type to set it up this way with the references still in the type def?
08-30-2019 02:33 PM
@adekruif wrote:
@crossrulz wrote:
You need to get rid of the references in the type def. This includes the DAQmx Task, Occurance, and File references. That does make sense. Your other application/machine cannot use them anyways.
Ok, that makes sense. Would have been helpful if that was in the documentation somewhere for noob's like me.
@Ben wrote:
@crossrulz wrote:
You need to get rid of the references in the type def. This includes the DAQmx Task, Occurance, and File references. That does make sense. Your other application/machine cannot use them anyways.
The type def can still be used provided the references are not used anywhere but the process context in which they were created ( i.e RT only use).
Ben
I won't be using any of the references on the PC side, only the RT side. If I understand correctly, I should be able to use the typedef with references and get it to work. Do I have to go through a variant data type to set it up this way with the references still in the type def?
I only used Network Streams once for a project that another started... so not an expert there.
But using TCP/IP I use a "flatten to String" to convert a type def (not a strict mind you!) to a string that is sent via TCP.
The type def I send is a cluster that consists of an enum to identify what type of message and a variant to deliver the message.
on the other side I used a unflatten from string to cast it back to the "enum and variant" cluster. I can then pass the variant to a "Variant to Data" and use a type that match the data that I was sending on the other side.
I hope that word salad helps.
Ben
08-30-2019 02:35 PM
Re: all of that conversion stuff
You should be able to do a test VI that that starts with the type def converts it and then converts it back and skip the network part until latterl.
Ben
08-31-2019 05:56 AM
@Ben wrote:
@crossrulz wrote:
You need to get rid of the references in the type def. This includes the DAQmx Task, Occurance, and File references. That does make sense. Your other application/machine cannot use them anyways.
The type def can still be used provided the references are not used anywhere but the process context in which they were created ( i.e RT only use).
No, I had to actually remove the references in order for the Create XXX Endpoint to accept it. Yes, I was messing around with the OP's type def.
But I do similar to Ben (Flatten to String, use TCP/IP directly), except I am a big fan of the STM (Simple TCP Messaging) library. It adds metadata to the data pack to act as the enum Ben eluded to.
09-03-2019 07:51 AM
@crossrulz wrote:
@Ben wrote:
@crossrulz wrote:
You need to get rid of the references in the type def. This includes the DAQmx Task, Occurance, and File references. That does make sense. Your other application/machine cannot use them anyways.
The type def can still be used provided the references are not used anywhere but the process context in which they were created ( i.e RT only use).
No, I had to actually remove the references in order for the Create XXX Endpoint to accept it. Yes, I was messing around with the OP's type def.
But I do similar to Ben (Flatten to String, use TCP/IP directly), except I am a big fan of the STM (Simple TCP Messaging) library. It adds metadata to the data pack to act as the enum Ben eluded to.
Thanks for that Tim.
As I indicated above I do not use network streams since TCP/IP is good enough for me. It sounds like streams are trying to protect developers from the possibility of trying to use references across process contexts.
Ben