01/27/2023
Hello.
We are facing a problem with the KeepAlive and recconnection from OPC UA Client to Server.
Perhaps the connection is not stable and we receive the error:
BadNoCommunication 'Server not responding to keep alive requests.'
We have the following when create session at the first opening:
session = await Session.Create(config, endpoint, false, "OPC UA Console Client", 60000, new UserIdentity(), null); // register keep alive handler session.KeepAlive += Client_KeepAlive;
Â
and then when the error takes place, it is managed by:
private void Client_KeepAlive(Session sender, KeepAliveEventArgs e)
{
if (e.Status != null && ServiceResult.IsNotGood(e.Status))
{
ConsoleWriteline(e.Status + " " + sender.OutstandingRequestCount + "/" + sender.DefunctRequestCount);
if (reconnectHandler == null)
{
ConsoleWriteline("--- RECONNECTING ---");
reconnectHandler = new SessionReconnectHandler();
reconnectHandler.BeginReconnect(sender, ReconnectPeriod * 1000, Client_ReconnectComplete);
}
}
}
private void Client_ReconnectComplete(object sender, EventArgs e)
{
// ignore callbacks from discarded objects.
if (!Object.ReferenceEquals(sender, reconnectHandler))
{
return;
}
session = reconnectHandler.Session;
reconnectHandler.Dispose();
reconnectHandler = null;
ConsoleWriteline("--- RECONNECTED ---");
}
The problem is that sometimes, if the reconnection takes long time (5-6 secs), it seems that we have more that one session opened.
Which can be the problem?
Thanks
Rob
1 Guest(s)