QOpcUa: renew secure channel
-
Using the QOpcUaViewer example I notice that after few minutes a line in the message window appears:
Info: "Connection 25 | SecureChannel 2246060434 | SecureChannel renewed" (:0, )
and the connection stays alive for long time.
Instead in my application after few minutes the connection closes and I have to connect again.Of course I tried to follow that example but I must forgot something important! Even inspecting again the code I don't find where it handle the renewing of the secure channel.
Please, can you help me to understand how this is done?
UPDATE
I enabled the messages fromopen62541
and I noticed that when the disconnection happens I get these errors:[20231003 10:37:23 I] unknown:0 - "Received a ServiceFault response"
[20231003 10:37:23 I] unknown:0 - "The ServiceResult has the StatusCode BadTimeout"
[20231003 10:37:23 W] unknown:0 - "Received Timeout for Publish Response"
[20231003 10:37:23 I] unknown:0 - "The ServiceResult has the StatusCode BadNoSubscription"
[20231003 10:37:38 I] unknown:0 - "Client Status: ChannelState: Closed, SessionState: Closed, ConnectStatus: Good"Why it receive these errors instead of renewing the channel? What am I missing?
-
Well, it seems that if I have NO subscriptions enabled it renew the channel and the connection is kept open.
Otherwise, if I have any monitoring enabled I get the errors above and the connection will be closed after few minutes.
Still I don't understand why.
-
@Chs_QtLearner no, even if the network is up and stable, the server closes the channel.
-
@Mark81 , I haven't no ability to solve it , but I want to know more, because I also work in this way. My concern is " Connect many machine controllers (PLC.. ) with QOpcUa, to collect data from machine in cycling , if one machine is disconnected (switch off or restart ...), then restart again , Do OpcUaClient could receive one signal from this machine, then could trigger one procedure to create one new instance to connect it again.
If not possible , I prefer to change to proposal "kepware collection".
Thanks for your information !