Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > On Sat, 21 Jul 2018 09:07:23 +0100, Chris Green wrote: > > [...] > > I want to be able to interrogate the server process from several client > > processes, some will interrogate it multiple times, others once only. > > They are mostly (all?) run from the command line (bash). > > > This sounds like a good approach for signals. Your server script sets up > one or more callbacks that print the desired information to stdout, or > writes it to a file, whichever is more convenient, and then you send the > appropriate signal to the server process from the client processes. > [snip useful sample scripts]
Yes, maybe, though I was hoping for something a bit more sophisticated. At the moment it's the 'client' processes which manage the output side of things, pushing it across to the 'server' would mean that the client does nothing except send a signal. As the outputs are to quite a variety of things (e.g. terminal screen, serial connection, LCD display) this would push a lot of code to the server which currently is quite nicely separated into client modules. Communicating by file is a possible approach I had considered though, the server can do its smoothing etc. of results and write them to a file which is then read as required by the client processes. The only issue then is the need for some sort of locking as one doesn't want the client to read while the server is writing. One could overcome this by using a temporary file though, mv/rename is supposed to be atomic. Going back to my original request the clients don't really need to be able to 'interrogate' the server, they just need to be able to access results produced by the server. So maybe simply having the server write the values to file is all that's really needed. -- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list