LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why can't the client receive array over TCP?

Solved!
Go to solution

I have a server (PC.vi) and client (xbee.vi) and have set up a simple TCP connection. 

 

The server (PC) sends a flattened array of doubles to the client (xbee).  When the client attempts to unflatten it and print out the values they look different from what the server is sending. 

 

I'm not able to understand why. 

 

I have attached both files (and 1 dependency file: createsetuppacket.vi). 

Download All
0 Kudos
Message 1 of 5
(2,974 Views)

Please note I am sending non-zero values like (1,2,3.5,etc...). 

 

I feel like the server code is correct (flattening) but I'm skeptical about my client code (unflattening).

The client receives the data but I'm thinking I am not casting it correctly.

 

 

0 Kudos
Message 2 of 5
(2,971 Views)

The Type Cast isn't quite going to work for you.  The reason is that the length of the array is being prepended to the data in the array when you flatten to string.  You need to recover in the same fashion that you are encoding.  So you can either use the Type Cast with the PC or you can use the Unflatten from String on the xbee.  To reduce the amount of data sent over the ethernet bus (if you care about the extra 4 bytes) I would use the Type Cast on both sides.


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
0 Kudos
Message 3 of 5
(2,964 Views)

crossruiz -

 

I have uploaded a simple example of an array of 3 double values.  I flatten it and then immediately attempt to unflatten it, however I am still not successful.

 

I would greatly appreciate it if you, or anyone, could please modify the program to yeild the same array of 3 dbl values after unflattening. 

 

I feel like there is something I am not understanding.

 

I will definitely award points.

0 Kudos
Message 4 of 5
(2,922 Views)
Solution
Accepted by topic author invasion2121

You need to provide the actual data type to the type input.  So you need to wire a 1D array of doubles to the Unflatten String.


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
0 Kudos
Message 5 of 5
(2,918 Views)