I want to create a two-part program. Listener (server, if you want) and sender (client). I did some research and found out that this is done using a method that programmers call IPC (interprocess communication); Iβm sure that you know what this means, Iβm just expanding the abbreviation so that you know that I donβt think it means that these are online cannibal pets (or some other unpleasant things related to this).
I read that a good way to achieve this is to use dbus. So I did some research on dbus, and now I'm just confused. There are apparently a lot of things you can do with dbus, like sending notifications to Gnome Shell or talking to Network Manager. I do not want to do this! I just want to make two simple programs that talk to each other. To add to this, some tutorials and documentation show examples with python 2, some use 3, some import dbus and import Gio! Most of the information I found is above my head, which also worsens my efforts.
Would anyone be so kind as to show me a simple, elegant example of how to get a program that essentially does this:
$ ./server Server is not running yet. Putting on listening ears. $ ./client Hi server: a client said "Hi" $ ./server Server is already running. $ ./server stop Server exiting... $ ./client Do a barrel roll client: No one can hear me!!
Here's how a simple session goes (using the bash shell, of course). I would like to use Python 3 and any dbus bindings are most suitable at the moment (I assume it will be gi.repository). To clarify, this will be for Linux.
source share