ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

取消
显示结果 
搜索替代 
您的意思是: 

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

0 项奖励
1 条消息(共 7 条)
4,424 次查看

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 项奖励
2 条消息(共 7 条)
4,359 次查看

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 项奖励
3 条消息(共 7 条)
4,342 次查看

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

0 项奖励
4 条消息(共 7 条)
4,335 次查看

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 项奖励
5 条消息(共 7 条)
4,323 次查看

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 项奖励
6 条消息(共 7 条)
4,318 次查看

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 项奖励
7 条消息(共 7 条)
4,307 次查看