OPCUA, can PLC as server check if there is client connection?

In OPCUA communication, if the PLC is the server, is there a function block to view the current PLC’s connection to the host computer?

Best regards

Hi, not directly. But you can use Runtime server information for that.

Some NodeIDs in the OPC UA server namespace interesting for debugging.

NodeID BrowsePath Description
0:i=2259 0:Objects/0:Server/0:ServerStatus/0:State Server state
0:i=2277 0:Objects/0:Server/0:ServerDiagnostics/0:ServerDiagnosticsSummary/0:CurrentSessionCount Current session count
0:i=2285 0:Objects/0:Server/0:ServerDiagnostics/0:ServerDiagnosticsSummary/0:CurrentSubscriptionCount Current subscription count

Runtime Server Information

  • How many clients connected?
  • Who (URI of client) is connected?
  • How many subscriptions?

see Root.Objects.Server.ServerDiagnostics

1 Like

Thank you for your reply, I managed to find that information through UAExpert. So can my PLC as server get this information itself?

Yes, you have to use ASOPCUAc library for that. B&R Online Help

OPCUAc2277.zip (162.5 KB)
Thanks, I managed to read the 2277 data. Attached is my test project.

1 Like