Issue with writing tag value when client close automatically

I am facing issue in writing tag value when client close automatically.
I have one gateway tag and want to write value to that tag on client start up and shut down, it is working but it fails when computer power is lost abruptly like power outage, hard restart, etc.
I am unable to handle this event.
Please help me to get out of this.

Use a client timer event that writes a changing value to one tag. Use a gateway timer event that watches that tag and writes to the target tag when the first tag stops changing.

1 Like

Thank you, but I am not able to understand.
I just want to monitor client is running or down through tag.
Can you please explain briefly?

Power cuts or network cable cuts don’t allow the client to write a tag in the gateway to say “I’m dead”. Physically not possible. It would be like a dead person updating their will after death. So the gateway must have the information to decide for itself when the client is gone. The only meaningful mechanism for this case is to monitor for the absence of something the client is known to do. The gateway naturally monitors a list of sessions, but the timeout for that is rather long (minutes). If that’s soon enough for your needs, consider using that infrastructure. Otherwise, make the client do something at a faster pace that you can monitor in the gateway, and when it stops, the gateway knows the client is dead.

Okay…I will try.
Thank You.