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

Forum Scope


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
Rob Fra
New Member
Forum Posts: 2
Member Since:
sp_UserOfflineSmall Offline
01/27/2023 - 05:04
sp_Permalink sp_Print


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))

session = reconnectHandler.Session;
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?



Forum Timezone: America/Phoenix
Most Users Ever Online: 202
Currently Online: Randy Armstrong
Guest(s) 32
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1219
Posts: 4064