I have two python applications. I need to send commands and data between them (between two processes). What is the best way to do that?
One program is a daemon who should accept commands and parameters from another GUI application.
How can I make daemon to monitor comands from GUI, while making it's job? I prefer solution would be crossplatform.
p.s. I use pyqt4 and python.
You can use the following methods for data interchange:
Socket Programming : In Qt you can access QtNetwork module. See qt assistant for examples
IPC : Use shared Memory implemented in QSharedMemory class.
If this application will run on unix os only, then you can try Posix based message queue etc. for data interchange
DBUS : You will find both python and Qt have DBus based support. In Case of python you need to find the relevant module.
Using Multi Processing module
Using Posix/SystemV based IPC mechanism aka pipes, queue, etc.
While it's not related to the way of the communication, I recommend checking out the pickle/cPickle module (which can encode objects into string streams and vice versa). Very useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With