Howto setup/connect to a listening server [dbus_server_liste (...)] ?
Mike Gorse
mgorse at novell.com
Fri Jul 22 10:12:50 PDT 2011
Hi Rony,
My guess is that you're running a main loop that isn't listening for new
connections on the DBusServer. If you're using glib, then there's a
function in dbus-glib called dbus_server_setup_with_g_main that will
integrate the server into the glib main loop. Otherwise that function
might be useful to look at (I don't understand how watches work all that
well, but they need to be set).
-Mike
On Fri, 22 Jul 2011, rony wrote:
> Starting successfully the server like this:
>
> DBusServer *server=dbus_server_listen(address, &err);
>
> ... no error indicated, hence: ...
>
> dbus_server_set_new_connection_function(server, new_connection_callback, // callback function
> ccb, // *data
> (void (*)(void*)) RexxFreeMemory // memory free function
> );
>
> To connect to the server using from another session using:
>
> DBusConnection *conn=dbus_connection_open_private(address, &err);
>
> ... no error indicated ...
>
>
>
> The problem: using the addresses "unix:path=/tmp/dbus-test" or "tcp:host=localhost,port=23000,family=ipv4;" allows to run dbus_server_listen() and doing a
> dbus_connection_open_private() with no errors. [I can pass the pointers to respective dbus-functions.]
>
> However, the registered new_connection_callback()-function gets never invoked and if sending messages from the client no answers are received, but rather timeouts occur.
> Here's the signature that compiles successfully:
>
> void new_connection_callback (DBusServer *server, DBusConnection *conn, void *data) {...}
>
>
>
> When killing the server, then a pending call to the server from the client sessions stops (with a "org.freedesktop.DBus.Error.NoReply" error message).
>
> This is running on Ubuntu 64 with dbus 1.4.0.
>
> What could be the reason(s) that the new_connection_callback()-function does not get invoked? Are there any additional steps that need to be taken in order for the client
> to be able to successfully connect to the server and become able to communicate with it?
>
> ---rony
>
>
>
>
>
>
More information about the dbus
mailing list