On 08/01/13 17:32, MJ Ray wrote:
I think the best approach is to build on well-tested available libraries. I used Perl, but I expect Python and other languages have good libraries too. Perl did have the benefit of both serial and TCP connections being under IO::Socket and behaving in fairly similar ways.
I agree with the idea of using standard and well tested libraries.
As things stand I'm not competent in Perl or Python but Python is higher up my list of things to learn so I'm leaning that way.
The best way to ensure a script restarts if it fails is to run it from something like daemon or maybe even init (with inittab), but beware that the device or connection may be left in an unclean state after a crash and set restart parameters so that the fastest possible series of crashes and restarts won't harm the device.
I Googled for "writing communications daemon in python" and there's plenty of examples out there, but going back to the point about sticking with well tested libraries it's hard to sort the wheat from the chaff. Can anyone recommend any good resources (dead tree considered) to get me started? As a python novice (but, I like to think, a competent programmer) I don't know the right places to look for reliable python resources that don't assume years of python experience.