B&R OPC-UA Server Connected Client Information

Hello,

My B&R PLC is running an OPC-UA server.
Is there a way to get any information on the clients that are connected at runtime please?

For example, I would like to know how many clients are currently connected to the server on my PLC and use this value in my Automation Studio code.

Thank you.

A sample task is described in the online AS-Help with following link:
B&R Online Help (br-automation.com)
ReadSessionDiagnosticsArray (Library/AsOpcUac/LibAsOpcUac_ReadSessionDiagnosticsArray_ST.zip)

1 Like

Thank you Corne :slightly_smiling_face: :+1:t4:

With this method, we need to use our PLC code to connect a client to the server that is running on the same PLC. Is this the only way? It seems strange that the server cannot tell how many clients are connected without connecting another client to find out. This also means that the number of clients connected will always be +1 due to the self connection?

There is no other way at the moment.
This also works with a remote connection.
The default value of the number of sessions is 50 and this can even be adapted.
Internal OPC UA connections are not uncommon and is for instance also used by mappView.

1 Like

Hello @SeanBotHive ,

I’ve recently had the same question from the customer. I tried the solution with the OpcUa_any without programming.

The number of clients connected to the OpcUa server can be indirectly determined using the CurrentSessionCount diagnostic datapoint. This datapoint can be mapped to a variable using OpcUa_any (OpcUa client). In the OpcUa_any client it is enough to switch “Server diagnostics” to on and set the Url, which is the localhost (the OpcUa client is on the PLC and connects to the OpcUa server, which is also on the PLC).

3 Likes

Nice, thanks Pavel! I will give it a go.

2 Likes