From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tcp ip multiple connections save previuos values

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

Download All
0 Kudos
Message 1 of 7
(3,588 Views)

You can drag the bottom edge of the shift register to get the previous 2, 3, or however many you want, pieces of data.

 

more shift reg.PNG

0 Kudos
Message 2 of 7
(3,523 Views)

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:

array.JPG

0 Kudos
Message 3 of 7
(3,506 Views)

Perhaps you can initialize the shift registers with your current array of data before you start running the loop?

0 Kudos
Message 4 of 7
(3,499 Views)

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?

0 Kudos
Message 5 of 7
(3,487 Views)

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.

0 Kudos
Message 6 of 7
(3,482 Views)

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.

0 Kudos
Message 7 of 7
(3,471 Views)