Interface losing connection after certain amount of time
When connecting the OPCUA_Interface with a PLC I lose connection with the PLC after a certain amount of time. One kicks me out after 2 min, another after 15 min (2 different connections).
The interface seems not to notice the disconnect because the value of isConnected in the interface stays on true but if I check the connected clients to the PLC the interface is gone (which was there on startup).
Reading a value after the disconnect on node level gives me the status value: Connection error
I import the nodes with the editor button but remove all nodes I dont need. And I dont continuously get new values on the nodes I keep. I can have the same values (no changes) for long periods of time.
Does the Interface only keeps the connection alive if the values continuously update or is something else going wrong?
Answer
The interface is only able to detect a disconnection if
StatusCode.BadConnectionClosed
is given back on a read value.
It might be a good idea to read one value in a periodical way and to test if the connection breaks in this situation.
As a quick fix I am subscribing to the current time of the server which updates every second.
And this does keep the connection alive.
But this feels more like a dirty fix instead of a solution to the problem.
Yes I understand but the used Library gives us no direct information about disconnection events. And I don't know exactly in your case who is closing the communication when nothing happens - is it the client or the server. I am closing this issue because for the moment we don't have a better solution.
Customer support service by UserEcho
Yes I understand but the used Library gives us no direct information about disconnection events. And I don't know exactly in your case who is closing the communication when nothing happens - is it the client or the server. I am closing this issue because for the moment we don't have a better solution.