Hi, <div><br></div><div>For my semester project i am using dbus for interprocess communication between different services. Everything is working fine when all the services are on a single host.</div><div><br></div><div>I am wondering if i can run my services on different host using dbus over tcp??? I dig out this mailing list and found that some people have done this and using that information i tried to run a server(have a function which add two number ) and client (right now on same host but using dbus tcp) </div>
<div><br></div><div><br>
</div><div><div>My session-local.conf looks like this: </div><div><br></div><div><br></div><div><busconfig></div><div> <type>session</type></div><div> <listen>tcp:host=localhost,port=1234</listen></div>
<div> <listen>unix:tmpdir=/tmp</listen></div><div></busconfig></div></div><div><br></div><div>Main part of my server : </div><div><br></div><div>g_type_init();</div><div>mainloop = g_main_loop_new (NULL, FALSE);</div>
<div>*connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);</div><div>dbus_connection_set_allow_anonymous((DBusConnection*)connection,TRUE);<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">*bus_proxy = dbus_g_proxy_new_for_name (connection,
                                         DBUS_SERVICE_DBUS,
                                         DBUS_PATH_DBUS,
                                         DBUS_INTERFACE_DBUS);</span></div><div><span class="Apple-tab-span" style="white-space:pre">if (!dbus_g_proxy_call (bus_proxy, "RequestName", &error,
                                G_TYPE_STRING, service_name,
                                G_TYPE_UINT, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER,
                                G_TYPE_INVALID,
                                G_TYPE_UINT, &request_name_result,
                                G_TYPE_INVALID)) {
                        printf ("Failed to register %s",service_name);
                        lose_gerror("",error);
                }</span></div><div><span class="Apple-tab-span" style="white-space:pre">obj = g_object_new (SOME_TYPE_OBJECT, NULL);
dbus_g_connection_register_g_object (connection, "/project/demo/remote", G_OBJECT (obj));
g_main_loop_run (mainloop);</span></div><div><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div>Above code is working fine .</div><div><br></div><div>My client :</div><div><br></div><div><div> gchar * server = g_strdup_printf ("tcp:host=localhost,port=1234");<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div> *connection = dbus_g_connection_open (server, &error);</div></div><div><br></div><div><div>add_object = dbus_g_proxy_new_for_name (connection,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> DBUS_REMOTE_SERVICE1,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span> DBUS_REMOTE_OBJECT,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> DBUS_REMOTE_INTERFACE1);</div></div><div><br></div>
<div><div>if (!dbus_g_proxy_call (add_object, "Add", &error,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> G_TYPE_INT, a,G_TYPE_INT,b, G_TYPE_INVALID,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> G_TYPE_INT, &result, G_TYPE_INVALID))</div>
<div> <span class="Apple-tab-span" style="white-space:pre">                </span>lose_gerror ("Failed to complete Addition", error);</div></div><div><br></div><div>While running client code i am getting following error:</div>
<div><br></div><div>Failed to complete Addition: Connection was disconnected before a reply was received</div><div><br></div><div>I am stuck here . Is this the issue of authentication ??? or i am missing something???</div>
<div> </div><div>-Rajeev</div><div><br></div><div>PS : I am newbie in dbus, so please point out if i am doing something stupid.</div><div><br></div><div><br></div>