PviServices, reconnection to another PLC

Hi there,

I created a program in C# using PviServices V4.11. It works OK.

However, I would like to correctly disconnect and clean up objects of one PLC and connect another PLC within one program.

I tried to use sequential unlinking of the event handlers of the PV, CPU and Service objects followed by Disconnect() and setting the objects to null.

The next attempt to connect to any PLC ends with an exception. I think this is my fault caused by incorrect releasing the objects. I couldn’t find an example of disconnecting in the help nor in demo projects.

Does anyone have experience with this?

Thank you

Perhaps you have to call the method Remove additionally.
This method Remove is available in PV, CPU and Service objects.

Have not tried it myself.

That’s exactly it!
Thanks :+1: