LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared variable reconnection time is slow

Hi,

 

I'm communicating between cRio and PC using shared variables. Connection is working fine, but I'd like to improve the functionality when connection is lost between the two.

 

When I disconnect the Ethernet cable between cRio and PC, my program notices this by monitoring errors.

When I connect the cable, clear the errors and try to open connection after a while, the program can establish connection, but it takes some time, maybe 30-60s from connecting the cable.

Are there any actions that I could do to make re-connection faster? 

Thanks.

0 Kudos
Message 1 of 4
(1,523 Views)

My honest advice:  Stop using Network Published Shared Variables.  They are slow, very insecure (anybody on the network could update them), and have caused me so many very weird race conditions.  Instead, use a direct TCP connection to pass data back and forth between the cRIO and PC.  I do this with a loop specifically for this communication on each side an use a queue or User Event to pass the data on to whoever needs it.  The loop can detect a disconnection (have an error) and close the connection and go back to trying to establish a connection (cRIO as the server uses the TCP Create Listener).  Assuming you are using static IP addresses, I have had disconnections and be able to reconnect seemingly as soon as I reconnect the cable.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(1,493 Views)

In my case there is no possibility for security threats but there's also no possibility to change to direct TCP at this point.

I just would like to know if there is any way to get reconnection a bit faster when using shared variables. Is there some reset feature/process or something like that, which would speed up the reconnection?

 

0 Kudos
Message 3 of 4
(1,489 Views)

Are Shared variables the same as network shared variables? (I haven't used them), if so, there's a Read with Timeout that you can use.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 4
(1,471 Views)