OPC UA Server session timeout|OPC UA Standard|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
OPC UA Server session timeout
Avatar
OPCUA USER
Member
Members
Forum Posts: 53
Member Since:
01/07/2022
sp_UserOfflineSmall Offline
1
05/16/2024 - 23:29
sp_Permalink sp_Print sp_EditHistory

I have developed OPC UA SERVER application using CSharp(C#) language.

My requirement is

OPC UA server shall close an established OPC UA session when OPC UA client is seen as inactive during a configurable period of time.

I have tried the following way

1.set maximum session timeout = 60000ms in OPC UA Server(in config) and run the OPC UA Server

2.Connect OPCUA Server with UA Expert (OPC UA Client)

3.Disconnect UAExpert

4. wait for more than 1 minute

5. check session has removed in server

 

Once I disconnect the UA Expert session is closed automatically. the following event has raised when disconnect the UA Expert.

private void EventStatus(Session session, SessionEventReason reason)
{
LastEventTime = DateTime.UtcNow;
PrintSessionStatus(session, reason.ToString());
}

My question is:

OPC UA Server is not waiting till 1min to close the server session.session is closed immediatly when disconnect the UAExpert

Can you help me? how to achieve it?

Avatar
Randy Armstrong
Admin
Forum Posts: 1568
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
05/20/2024 - 07:55
sp_Permalink sp_Print

You need to write a test client that keeps the socket open but does not send any requests to the server.

If you use a product like UAExpert it is doing a lot of things to clean up properly.

Avatar
OPCUA USER
Member
Members
Forum Posts: 53
Member Since:
01/07/2022
sp_UserOfflineSmall Offline
3
05/20/2024 - 21:55
sp_Permalink sp_Print

you mean to say, this feature not implemented in UAExpert properly right?

can you suggest me to use any other open source OPC UA Client tool?

Avatar
Randy Armstrong
Admin
Forum Posts: 1568
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
05/21/2024 - 09:24
sp_Permalink sp_Print

UAExpert is not a test tool designed to prove specific Server behaviors. It is correctly implemented for what it is designed to do.

Avatar
OPCUA USER
Member
Members
Forum Posts: 53
Member Since:
01/07/2022
sp_UserOfflineSmall Offline
5
05/23/2024 - 04:37
sp_Permalink sp_Print

Can you suggest me to use OPC UA client tool for testing session timeout with OPC UA Server?

Avatar
Randy Armstrong
Admin
Forum Posts: 1568
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
05/23/2024 - 05:01
sp_Permalink sp_Print

You need to write your own test client using an SDK. Any fully functional client will include keep alives that are designed to prevent a session from expiring.

Avatar
OPCUA USER
Member
Members
Forum Posts: 53
Member Since:
01/07/2022
sp_UserOfflineSmall Offline
7
05/29/2024 - 00:42
sp_Permalink sp_Print

I have developed a OPC UA Client by following way. But when I close the OPC UA Client, the session has removed from the server immediately, but I have configured server session timeout is 60sec

OPCUA Client code:

oPCUAServerUrl = "opc.tcp://" + "localhost" + ":" + "62541";
client = UAClientFactory.GetClient(_oPCUAServerUrl);
client.KeepAliveInterval = 600000;
client.StateChanged += _client_PrimaryServer_StateChanged;
client.Connect();

So what changes required in this code for client that keeps the socket open but does not send any requests to the server?

Avatar
Randy Armstrong
Admin
Forum Posts: 1568
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
8
05/29/2024 - 08:09
sp_Permalink sp_Print

I recommend you start with a working sample client and modify it to meet your requirements.

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