How can i detect that my connection is off?

My device only send me results from an operation, but i need to know if the cable was unpluged or the device if off, to tell the operator that the system is off.

How can i do that? I´m using Socket Wrench free edition, but i can use some other stuff, but it has to be free!

Thank you,
Guilherme Costa