Problem with cliente multiple sessions|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Problem with cliente multiple sessions
Avatar
Rob Fra
New Member
Members
Forum Posts: 2
Member Since:
01/27/2023
sp_UserOfflineSmall Offline
1
01/27/2023 - 05:04
sp_Permalink sp_Print

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

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 16
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1347
Posts: 4571