hi <br>I am launching one service through client and trying to invoke method <br>exposed by service to message bus, but i am getting following error,<br><br>Error: Message did not receive a reply (timeout by message bus)<br><br>Following is code <br><br>server.c<br><br>#include <stdio.h><br>#include <glib-object.h><br>#include <glib/gi18n.h><br>#include <dbus/dbus-glib.h><br>#include <dbus/dbus-glib-bindings.h><br>#include "server.h"<br><br>static gboolean my_server_many_args()<br>{<br> if(1)<br> {<br> FILE* fp;<br> fp = fopen("nefile","w");<br> fclose(fp);<br> printf("\nmy_server_many_args\n"); <br> return TRUE; <br> }<br> return
FALSE;<br>}<br><br>#include "my-server-glue.h"<br><br><br><br>static GMainLoop *loop;<br>DBusGConnection *connection;<br>static MyServer *server;<br><br>G_DEFINE_TYPE(MyServer, my_server, G_TYPE_OBJECT);<br><br>/* Class init */<br>static void<br>my_server_class_init (MyServerClass *my_server_class)<br>{<br> //g_type_class_add_private (e_data_book_factory_class, sizeof (EDataBookFactoryPrivate));<br> printf("\ni am class init\n");<br> dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (my_server_class), &dbus_glib__object_info);<br>}<br><br>/* Instance init */<br>static void<br>my_server_init (MyServer *server)<br>{<br>}<br><br><br><br>int<br>main (int argc, char **argv)<br>{<br> <br> <br> GError *error = NULL;<br> DBusGProxy *proxy;<br> char req_name = {"amol.gajewar"};<br> guint32 request_name_ret,flags;<br><br> g_type_init ();<br><br> loop = g_main_loop_new (NULL,
FALSE);<br> <br> /* Obtain a connection to the session bus */<br> //connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);<br> connection = dbus_g_bus_get (getenv("DBUS_STARTER_ADD"),&error);<br> <br> if (connection == NULL)<br> {<br> printf("\nFailed to open connection to bus\n");<br> } <br><br> proxy = dbus_g_proxy_new_for_name (connection,<br> DBUS_SERVICE_DBUS,<br>
DBUS_PATH_DBUS,<br> DBUS_INTERFACE_DBUS);<br> <br> <br> <br>#if 1<br><br> if(!org_freedesktop_DBus_request_name (proxy, "com.example", 0, &request_name_ret, &error))<br> {<br> g_warning ("There was an error requesting the name: %s", error->message); g_error_free (error); return FALSE;<br> }<br><br>#endif<br><br><br> server = g_object_new (TYPE_MY_SERVER, NULL);<br><br> dbus_g_connection_register_g_object (connection,"/com/example/MyServer", G_OBJECT (server));<br> g_main_loop_run (loop);<br> <br> dbus_g_connection_unref (connection);<br> return 0;<br>}<br><br><br>client.c<br><br>#define GETTEXT_PACKAGE<br>#include
<dbus-1.0/dbus/dbus.h><br>#include <glib-object.h><br>#include <glib/gi18n-lib.h><br>#include <dbus-1.0/dbus/dbus-glib.h><br>#include <dbus-1.0/dbus/dbus-glib-lowlevel.h><br>#include "my-server-bindings.h"<br><br><br><br>static GMainLoop *loop;<br><br>int main (int argc, char **argv)<br>{<br> DBusGConnection *connection;<br> DBusGProxy *proxy,*newproxy; <br> DBusMessage *message; <br> DBusError derror;<br><br> GError *error;<br> char **name_list;<br> char **name_list_ptr;<br><br> guint32 request_name_ret;<br><br> g_type_init ();<br><br> // loop = g_main_loop_new (NULL, FALSE);<br><br> error = NULL;<br> connection = dbus_g_bus_get (DBUS_BUS_SESSION,<br>
&error);<br> <br> if (connection == NULL)<br> {<br> g_printerr ("Failed to open connection to bus: %s\n",<br> error->message);<br> g_error_free (error);<br> exit (1);<br> }<br><br> /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */<br> #if 1 <br> newproxy = dbus_g_proxy_new_for_name (connection,<br>
DBUS_SERVICE_DBUS,<br> DBUS_PATH_DBUS,<br> DBUS_INTERFACE_DBUS);<br><br>#if 1<br> dbus_error_init (&derror);<br>printf("\nstarting\n");<br> if (!dbus_bus_start_service_by_name (dbus_g_connection_get_connection (connection),<br>
"com.example",<br> 0, NULL, &derror)) {<br> dbus_set_g_error (error, &derror);<br> dbus_error_free (&derror);<br> printf("\n i am failed 1 \n");<br> g_printerr ("Error: %s\n", error->message);<br> return FALSE;<br> }<br>printf("\nstarted\n");<br>#endif<br> /* Call ListNames method, wait for reply */<br> error = NULL;<br> if (!dbus_g_proxy_call (newproxy, "ListNames", &error, G_TYPE_INVALID,<br> G_TYPE_STRV, &name_list, G_TYPE_INVALID))<br>
{<br> /* Just do demonstrate remote exceptions versus regular GError */<br> if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION)<br> g_printerr ("Caught remote method exception %s: %s",<br> dbus_g_error_get_name (error),<br> error->message);<br> else<br> g_printerr ("Error: %s\n", error->message);<br> g_error_free (error);<br> exit (1);<br> }<br> /* Print the results */<br> <br> g_print ("Names on the message bus:\n");<br> <br> for (name_list_ptr = name_list; *name_list_ptr;
name_list_ptr++)<br> {<br> g_print (" %s\n", *name_list_ptr);<br> }<br> g_strfreev (name_list);<br><br> <br>#endif<br>#if 1<br> proxy = dbus_g_proxy_new_for_name_owner (connection,"com.example","/com/example/MyServer","com.example.MyServer", &error);<br><br> if (!proxy) {<br> g_printerr ("Error: %s\n", error->message);<br> printf("i am failed 2 ");<br> return FALSE;<br> }<br><br><br><br> if(!com_example_MyServer_many_args (proxy,&error))<br> { <br> printf("\ni am failed\n");<br> <br> /* Just do demonstrate remote exceptions versus regular GError */<br> if (error->domain == DBUS_GERROR
&& error->code == DBUS_GERROR_REMOTE_EXCEPTION)<br> g_printerr ("Caught remote method exception %s: %s",<br> dbus_g_error_get_name (error),<br> error->message);<br> else<br> g_printerr ("Error: %s\n", error->message);<br> g_error_free (error);<br> exit (1);<br> }<br><br>#endif<br> <br><br> g_object_unref (newproxy);<br> g_object_unref (proxy);<br> return 0;<br>}<br><br><br>any pointers on this are welcome<br><br><br><br><br><br><p> 
        
        
                <hr size=1></hr>
Here’s a new way to find what you're looking for - <a href="http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/">Yahoo! Answers</a>