how to use dbus_connection_open

John (J5) Palmieri johnp at redhat.com
Mon Apr 21 14:03:44 PDT 2008


On Mon, 2008-04-21 at 08:23 -0700, Wilson Khoo wrote:
> I have not work with this interface before. below is the pseudo code of what I did. dbus_connection_open returns a valid g_hConn with no error, however upon executing dbus_bus_reguster I get gerrror = "g_error    {name=0x00914a40 "org.freedesktop.DBus.Error.NoReply" message=0x00915560 "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken." dummy1=0 ...} . How can I go about implementing dbus to communicate over TCP? 
> 
> I have Ubuntu running and have its session.conf changed to listen on both 
>  <listen>unix:tmpdir=/tmp</listen>
>   <listen>tcp:host=192.168.0.1,port=50000</listen>
> 
> 
> #define DEFAULT_TCP_ADDR   "tcp:host=192.168.0.1,port=50000"
> 
> main ()
> {
> 
> g_hConn = dbus_connection_open(DEFAULT_TCP_ADDR,&g_error);
> // check for valid g_hConn
> 
> ret = dbus_bus_register( g_hConn , &g_error );
> // check for valid ret
> 
> ret = dbus_bus_request_name (g_hConn,g_app_name, DBUS_NAME_FLAG_REPLACE_EXISTING, &g_error );
> // check for valid ret
> 
> ...
> }

Have you tried setting DBUS_SESSION_BUS_ADDRESS, using dbus_bus_get and
seeing if you get the same results?  You should also put your bus in
verbose mode to see if it is receiving the message.  You may need to
compile D-Bus with verbose mode on.  To run in verbose mode set
DBUS_VERBOSE=1 and run dbus with the --nofork switch.  Also check to see
if your firewall is blocking messages.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list