Use DBus daemon to exchange message from C application to python application
<p>Hi I am pretty new to DBus daemon and would like to accomplish simple message exchange between C application and python application, which are running on custom linux-like environment. My understanding is</p>

<ol>
<li>First, start dbus-daemon from init file </li>
<li>Register the C application and the python application to the D-BUS</li>
<li>Send message
(it's just a simple string) on the bus between these 2 applications.</li>
</ol>

<p>My questions are regarding (2) and (3) above. How can C application and python application register to the same bus?</p>

<p>Also, what APIs need to be invoked to send string messages between these 2 applications?</p>

<p>There are two default buses on each Linux system - the system bus (shared for all users, made for system services) and the session bus. All DBus libraries let you trivially connect to one of those buses.</p>

<p>Then, in the receiver process, you need to take ownership of a bus name (a string that will let other processes find you), and register an object providing some methods. And then you will be able to call those methods from another process.</p>

<p>The best DBus API for C is <a href="https://developer.gnome.org/gio/stable/GDBusConnection.html" rel="nofollow">https://developer.gnome.org/gio/stable/GDBusConnection.html</a> and the best API for Python is <a href="https://github.com/LEW21/pydbus" rel="nofollow">https://github.com/LEW21/pydbus</a></p>

python linux dbus