Closed tboegi closed 1 week ago
It's quite a long sleep. Otherwise looks good.
Note that this is a totaly useless configuration on the PLC side. The only thing that is happening on the IOC is a repeated log. I think that 10 seconds are even short, since no PLC programmer does fix this within 10 seconds.
Well, during development the connection might go down because of a simple update of the program on the PLC. That kind of restart will most likely be quite fast and a 10 s delay in worst case could be of annoyance.
I keep this PR open for more testing. The reason for this is that it does not make any sense to hammer a connection/connect() every 2 seconds followed by a "connection closed by remote". In this case there is something seriously wrong.
I think all review comments are addressed- thanks for the review
There was not really much information when adsReadStateLock() failed. One case was that the crate was run with a test-license, which had expired. Improve this a little bit by printing the error code.
Keep the loop to disconnect, reconnect and try again, to be able to recover some day. Make it less spammy by adding a sleep(10 seconds).