{"action":"created","issue":{"url":"https://api.github.com/repos/ruscito/pycomm/issues/4","labels_url":"https://api.github.com/repos/ruscito/pycomm/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/ruscito/pycomm/issues/4/comments","events_url":"https://api.github.com/repos/ruscito/pycomm/issues/4/events","html_url":"https://github.com/ruscito/pycomm/issues/4","id":98331327,"number":4,"title":"Connection Recovery","user":{"login":"cldodd","id":12900001,"avatar_url":"https://avatars.githubusercontent.com/u/12900001?v=3","gravatar_id":"","url":"https://api.github.com/users/cldodd","html_url":"https://github.com/cldodd","followers_url":"https://api.github.com/users/cldodd/followers","following_url":"https://api.github.com/users/cldodd/following{/other_user}","gists_url":"https://api.github.com/users/cldodd/gists{/gist_id}","starred_url":"https://api.github.com/users/cldodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cldodd/subscriptions","organizations_url":"https://api.github.com/users/cldodd/orgs","repos_url":"https://api.github.com/users/cldodd/repos","events_url":"https://api.github.com/users/cldodd/events{/privacy}","received_events_url":"https://api.github.com/users/cldodd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-31T07:18:01Z","updated_at":"2015-07-31T22:19:02Z","closed_at":null,"body":"Hi ruscito\r\nSorry, I am a Git novice and newbie to Python but old die hard AB man. Figured (Issues is how to post questions?) I have scripts running between CLX & ML1100 inserting data (Floats/Reals) into mySql on a Raspberry 2. I am impressed and thankful of your efforts in concluding this project - well done. My task is to provide a 24x7 (60 second update/storage) of PLC data for compliance on Water Treatment stations in remote locations. For this reason I have been testing to ensure NOTHING will break the script (my logger script) resulting in loss of data. During the testing I have been making/breaking ethernet connections while polling data and have had several issues where comms is lost and non recoverable. Have you any suggestions on how best to handle make/break situations allowing the CIP connection reestablish gracefully without crashing. Obviously I have rapped some try/except error handling clauses in the script but am struggling with maintaining continuity during abnormal situations. Any suggestions gratefully appreciated Regards Chris"},"comment":{"url":"https://api.github.com/repos/ruscito/pycomm/issues/comments/126825952","html_url":"https://github.com/ruscito/pycomm/issues/4#issuecomment-126825952","issue_url":"https://api.github.com/repos/ruscito/pycomm/issues/4","id":126825952,"user":{"login":"lynnlinse","id":9847608,"avatar_url":"https://avatars.githubusercontent.com/u/9847608?v=3","gravatar_id":"","url":"https://api.github.com/users/lynnlinse","html_url":"https://github.com/lynnlinse","followers_url":"https://api.github.com/users/lynnlinse/followers","following_url":"https://api.github.com/users/lynnlinse/following{/other_user}","gists_url":"https://api.github.com/users/lynnlinse/gists{/gist_id}","starred_url":"https://api.github.com/users/lynnlinse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lynnlinse/subscriptions","organizations_url":"https://api.github.com/users/lynnlinse/orgs","repos_url":"https://api.github.com/users/lynnlinse/repos","events_url":"https://api.github.com/users/lynnlinse/events{/privacy}","received_events_url":"https://api.github.com/users/lynnlinse/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T22:19:02Z","updated_at":"2015-07-31T22:19:02Z","body":"Likely the socket is 'recoverable', but unless you have made custom TCP keepalive changes in the Linux OS, then it could take HOURS for the lost socket to return your expected errors.\r\n\r\nSo one thing, look into your global TCP keepalive settings, which generally (always?) host-wide, meaning if you change, it changes for your entire Raspberry. Some systems default to start probes in 2 hours, so no error for 2+ hours!\r\n\r\nIf you really need sub-1-minute loss detection, you might need to add an external thread/task doing a PING of the PLC once every 30 seconds? The PING will give faster path-loss detection, then you'd need that thread to send a signal to your logger, having it abort the old socket, and start trying to open a new EIP connection. Obviously, if the path is lost (a disconnected cable), it could take an unknown amount of time to reconnect."}}