LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Client/Server Whiteboard - Like Netmeeting - Need advice

I won't get into details of the full project, but one part of the project is a whiteboard-like VI that works similar to the whiteboard in Netmeeting. I created a quick server and client VI to establish a TCP connection to allow the whiteboard to run for everyone. Run the server VI first and then the client VI and the whiteboards will open. Normally you would only have one whiteboard running, but this is a demo to allow the client and server to run on the same computer. Please execute the project to understand what the program does so that you understand the concept.

Now for my problem: I spent a several days designing this portion of my project and it is fairly usable, but the problem is that if you continuously draw on the screen for a long time (maybe 1 minute), the arrays will get rather large and will eventually slow the drawing process to a crawl. In a previous version I would draw to the screen, feedback the picture element, and then clear the array, thinking this would be the most efficient. Unfortunately it seemed to be pretty slow also.

I've only been using Labview for a year, so please forgive me if my code is sloppy or if I did things in a weird way. This is why I am posting this code. I'm really looking for advice on optimizing the code and fixing my main problem.
0 Kudos
Message 1 of 6
(3,142 Views)
Please use this zip file instead - I didn't see a way to edit my message above.
0 Kudos
Message 2 of 6
(3,134 Views)
Screen shot attached...
0 Kudos
Message 3 of 6
(3,131 Views)
VIs saved in 7.0 format just in case
0 Kudos
Message 4 of 6
(3,112 Views)
Hi Todd,

I'm not exactly sure how you're handling the data, but it looks like you're maintaining and constantly building upon an multiple arrays that contain line end-point coordinates. In theory, you don't want this array to keep growing forever, so at some point there should be a theoretical limit to this array. With your current implementation, there is no limit (except for disk space) to the size of this array because you can always add another group of end-points to the array. A couple of ideas:

- Maybe you could keep track of individual points on the plot (instead of end-points of a line), and check for (and flush) duplicate points. I realize this might have the adverse effect in smaller plots (since you have to keep track of every point vs. just a few lines), however, there is an obvious limit to the size of the array (if you discard duplicate points).

- Maybe you could downsample the amount of coordinates that you receive (only take every other coordinate or something similar). Something like this might be your best bet.

Good luck with your development,
Travis H.
LabVIEW R&D
National Instruments
0 Kudos
Message 5 of 6
(3,097 Views)
Hi Travis,

Thanks for your reply. I saw your post after I already solved the problem otherwise I would look into your suggestions. I thought I would post the solution here so that this code might help someone in the future.

To recap, I had a problem with a drawing slowdown using two different methods. The first method was to draw to a picture element and then loop this around the main while loop and then draw to the picture element again for every pixel movement captured. Reloading the picture element rapidly was a major drag on the CPU. So the second method I used was to store all pixels movements captured in an array and add another array to the second dimension every time the mouse button lifted. I would draw EVERYTHING in this 2D array everytime I looped around. This meant that the array could get rather large after a very short time and bog down the CPU.

So I realized that I could take the best of both methods mentioned and use a nested while loop inside another while loop. The outer while loop shifts the picture element around and the inner loop will continue to build and redraw only one row of the array until the mouse button is up. At this point I stop the inner loop and pass the picture element around null the arrays for the inner loop. Seems to accomplish everything I needed.

Hope this can help somebody else. The new code is attached
0 Kudos
Message 6 of 6
(3,078 Views)