03-21-2016 03:36 PM
Hello Everyone,
I want to proviade TCP/IP server than can accept multiple clients.
I'm using example vi from LabVIEW 2012 with Data Server Queue.vi.
The thing I want to have is array with all active connections and array with those connections but with previus state, I mean, before change: if one new connection income I need array with this connection and array before those connection. I want to achieve array with before-state connections whatever connections income or are closed.
How can I provide this based on LabVIEW 2012 tcp ip multiple connections example vi with Data Server Queue? I tried to use shift registers but I cannot get previous array.
I attached example server that I tried to use. The Array2 should output previus state array but it contains current values of active connections. There is example of clinet vi that I want to use.
Thanks for help,
Rafal
03-22-2016 10:41 AM
You can drag the bottom edge of the shift register to get the previous 2, 3, or however many you want, pieces of data.
03-22-2016 05:48 PM
Actually, in this case it not working. First of all, I have to initialize secnd shift register with some value. And if I provide empty array of connections I get what I want but after 1 second, in next while loop iteration I finally get current value of connections. So Array contains all active connections and I cannot do it like this:
03-22-2016 06:01 PM
Perhaps you can initialize the shift registers with your current array of data before you start running the loop?
03-22-2016 06:25 PM
I don't understand - how can initialize shift register with current array of data? I think the point is:
- in first iteration with no connections, current value is empty array and previous is the same
- when new connection income and is active, the current array value is one element and previuos is empty
- but in next iteration, when no new connnections are setted and only one connection is active, current value of array is one connection but now previuos value is one connection, too.
How can i save previus value of number of connections event if no new connection is income?
03-22-2016 06:31 PM
I just meant that you might have to put some code before your loop to initialize the shift registers correctly. Like, if I wanted to calculate the fibonacci sequence (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...) I wouldn't start by just picking zeroes to initialize the shift registers. In this case, I would put a 0 in the bottom and a 1 in the top shift register.
So maybe you can put some extra code in there to properly initialize the shift register for your application.
03-22-2016 07:03 PM
I understand what do you mean, but the question is how can i initialize loop to get separately previous state of array and dynamically changed array of active connections no matter if new connection is added to array or connection is closed and is removed from array. Thanks for replays and tips, i will try it.