LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot send strict typedef through network stream

Solved!
Go to solution

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!

Download All
0 Kudos
Message 1 of 9
(2,144 Views)
Solution
Accepted by adekruif

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 9
(2,132 Views)
Solution
Accepted by adekruif

@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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 9
(2,127 Views)

@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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 9
(2,122 Views)

@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?

0 Kudos
Message 5 of 9
(2,097 Views)

@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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 9
(2,079 Views)

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 

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 9
(2,077 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(1,992 Views)

@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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 9
(1,931 Views)