Jump to content

Value of the Network Shared Variable when the computer turns off


jangel22

Recommended Posts

Hi folks  :)

 

I'm working with NSV deployed in two computers (lets call them A and B), but I want to be able to make the value of the NSV in B false when the program exits in or when this computer turns off.

 

Any idea of how make this?

 

PS. Excuse my english.

 

Thanks in advance

 

 

 

 

 

Link to comment

Hi,

 

There are a few ways you can do this.

 

First way

Make the program in A write "true" to the NSV when it starts, and make it write "false" before it quits.

 

This is simple, but there is one disadvantage: If the program in A doesn't quit properly, then the value will stay "true". For example, if computer A loses power, the program stops running but it can't write "false".

 

Second way

Make the program in A write a value to the NSV every second. The program in B doesn't check the value, but it checks the timestamp. If the timestamp doesn't change for 5 seconds, then B sets a local flag to "false".

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.