Disconnecting client failure
Posted: 08 May 2020, 07:23
I have a C# program that communicates with KepServer.
It's working fine but the disconnect feature does not want to work.
I want the code to work so that when KepServer Runtime is booted, OPC client disconnects and tries to reconnect.
Currently code is made so that when it recognizes connection status change to Disconnected, ServerShutdownInProgress, ServerShutdown or ConnectionErrorClientReconnect it tries to disconnect like this: this.session.Disconnect(SubscriptionCleanupPolicy.Delete);
But nothing happens and after a while I get a timeout from this method. I also tried just Disconnect(); and I tried to fiddle with ReconnectDelay but the results are the same. In some rare debugging cases I somehow managed to reconnect the client, but not consistently and I cannot reproduce it anymore.
What am I doing wrong and why the Disconnect is not working? What would be the correct way to work in this kind of situation?
It's working fine but the disconnect feature does not want to work.
I want the code to work so that when KepServer Runtime is booted, OPC client disconnects and tries to reconnect.
Currently code is made so that when it recognizes connection status change to Disconnected, ServerShutdownInProgress, ServerShutdown or ConnectionErrorClientReconnect it tries to disconnect like this: this.session.Disconnect(SubscriptionCleanupPolicy.Delete);
But nothing happens and after a while I get a timeout from this method. I also tried just Disconnect(); and I tried to fiddle with ReconnectDelay but the results are the same. In some rare debugging cases I somehow managed to reconnect the client, but not consistently and I cannot reproduce it anymore.
What am I doing wrong and why the Disconnect is not working? What would be the correct way to work in this kind of situation?