I'm making an OPC client on winforms, client that connecting with server and reading data from it with OPC protocol. So, I successfull connecting to server, but when my program crashing or I'm closing it manually from task manager, connection with server is still exist (and that's not good).
Can I somehow check my program for correct ending ? And if my program ends incorrect then disconnect from server.
I tried to use myProcess.HasExited
, but it's not working.