LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem sending 2D array over TCP/IP

Solved!
Go to solution

Hello 2 all !

 

By using the attached vi's, i'm trying to send and receive a 2d array over tcp/ip, but i get a  "out of memory" error from LabView.

 

Where is the problem ?... I've adapted the examples provided by ni, but somewhere there seems to be a problem. 

 

Thank you 4 your time !

 

P.S. I'm using LabView 8.5.1 on Windows XP SP2

Download All
0 Kudos
Message 1 of 5
(4,243 Views)
Solution
Accepted by topic author AndreiN2014
I have did some modification for your TCP-transmit.vi, see attached. it should be run normally.
Message 2 of 5
(4,232 Views)

Your transmit does not sent the number of bytes before the number of columns. So the datatypes don't match. Fix the Transmit VI in this way:

TCP-Transmit_BD.png

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 3 of 5
(4,231 Views)
Thank you very much 4 your quick and great answers ! :smileywink:
0 Kudos
Message 4 of 5
(4,212 Views)

Your code still is overly complicated and does unecessary expensive operations (such as formatting) and inflates the data to be transmitted while causing a dramatic loss in precision. Formatting also adds significant amounts of code on both ends for no benefit at all.

 

There is no need to format into a 2D array of strings just to scan it back to 2D DBL array at the other end.

 

First you lose about 2/3 of the DBL precision (at least 10 decimal digits out of 15 are dropped, leaving you with only 5 decimal digits!) while inflating the data to be transmitted by 36%. Formatting and scanning operations are expensive in terms of CPU! Why do all that work for nothing?

 

As you can see, you can flatten the 2D DBL array directly and unflatten it later in the same way. Now the data is bit-by-bit identical (lossless!) on the other end and you transmitted significantly fewer bytes as a bonus.

 

Also note that if you place a small "built array" inside the FOR loop, you don't need to transpose. Again, less code!

 

Maybe the image can illustrate what I was trying to say. 🙂

 

Message Edited by altenbach on 01-03-2010 10:43 AM
Message 5 of 5
(4,191 Views)