09-16-2009 03:58 PM
Is there a way for my VI to 'detect' when someone has connected to it with a Remote Panel and requested control?
I have an issue (due to the size/complexity of my VI I'm sure) that when a RP gains control, after a period of time, the main VI begins to slow down and starts to lose data (it's coming from a TCP connection)!
I'd like to be able to see when a RP gains control, and automatically log them off after a period of time (5 min?). I know that there is a connection time-out on the web publishing page, but it appears to only come into play if 1 RP has control and another requests it. I need to be able to limit the control time of a single RP.
Solved! Go to Solution.
09-16-2009 04:29 PM
How about these functions?
If you look at the help menu for 'Client Connections' it is very helpful.
Using the 'connections' output, you can index that array to get helpful information about the current client.
You can then use a little timing logic to allow them to only connect for a specified time limit.
Then you can kick em out with 'close connection to client'
09-16-2009 04:31 PM
Here is the information you need for the 'connection' output
You can use 'remote' to see who currently has control of the RP.
Then you can use 'create time' and a little math to see the time difference between the current time and when they connected.
09-17-2009 11:24 AM
Thanks Cory,
I just dabble in LabView, so I'm unfamiliar with all the 'tricks of the trade'.
It looks like I'll be able to use the VI method you described...now I just have to figure out time stamp math...
Steve
09-17-2009 02:43 PM - edited 09-17-2009 02:47 PM
Cory,
Well, it almost worked...
I'm attaching my little test program 'RP Control.vi'. I've compiled this into an executable that's in my server path, so I can get to it from my laptop (on my network). When I run it from my server, I can press my 'Start' button and nothing happens--no client RP's are connected, so this is as expected.
When I connect via my laptop to the server, my laptop is now the remote client, but it's hasn't requested control -- again, nothing happens when I press my 'Start' button.
When the laptop requests control of the VI, and I press the 'Start' button from the laptop, I see all my data fields filled in, and I show my calculated 'End Time?' which is 1 minute after the laptop got control.
I can then keep pressing my 'Start' button, and see the 'Time Now' update, and when 1 minute elapses, I see my 'Close' LED turn on, indicating I should have activated the 'Close Connection To Client'.
However, the laptop still has control of the VI...it hasn't returned to the server.
Any suggestions as to what I may be doing wrong, or does the 'Close Connection To Client' work differently?
<edited>
Looking at the Method - 'RP.Close Connection To Client' does this return control of the VI to the server copy (which is what I want to do), or does it try to completely disconnect the Remote Panel (which is not what I'm looking for)?
09-17-2009 04:58 PM
I think I've got it working the way I want it to... It turns out that if I use the RP.LockControl, that 'bumps' any Remote Panels out of Controlling the VI. I can immediately follow it with a RP.UnLockControl which allows Clients to re-establish their control if/when they need to. EXACTLY what I was looking for! Thanks Cory for setting me on the right path.
Steve