Reputation: 23
I am using a Siemens S7 plc and an external opc ua server device (IBH Link UA).
On the client side I created a java application using milo to exchange data between the server and my client system.
Is there any way to recognize on the client side if the server loses the connection to the plc (e.g. somebody turns off the S7)?
Maybe some Listener or something?
When using UAExpert to display the data it reacts with empty value fields and a "BadNoCommunication" Statuscode to me turning off the S7. So I guess there is some way to do this.
I tried to add a NotificationListener implementing the onStatusChangedNotification to the subscription. But it doesn't get invoked in this situation.
Thanks in advance for your help!
Upvotes: 1
Views: 260
Reputation: 7005
Add a SessionActivityListener
via OpcUaClient::addSessionActivityListener
.
onSessionInactive
will be called if the session becomes inactive.
You do not need to take any action in this case, the client attempts to reconnect and re-establish a Session automatically. You'll be notified when a Session is activated via onSessionActive
.
Upvotes: 0