diff options
Diffstat (limited to 'test/echo-client.c')
-rw-r--r-- | test/echo-client.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/echo-client.c b/test/echo-client.c new file mode 100644 index 0000000..5c6ee42 --- /dev/null +++ b/test/echo-client.c @@ -0,0 +1,41 @@ +#include <dbus/dbus.h> +#include <stdio.h> +#include "watch.h" + +int +main (int argc, + char **argv) +{ + DBusConnection *connection; + DBusResultCode result; + DBusMessage *message; + + if (argc < 2) + { + fprintf (stderr, "Give the server address as an argument\n"); + return 1; + } + + connection = dbus_connection_open (argv[1], &result); + if (connection == NULL) + { + fprintf (stderr, "Failed to open connection to %s: %s\n", + argv[1], dbus_result_to_string (result)); + return 1; + } + + setup_connection (connection); + + /* Send a message to get things going */ + message = dbus_message_new (); + dbus_connection_send_message (connection, + message, + NULL); + dbus_message_unref (message); + + do_mainloop (); + + dbus_connection_unref (connection); + + return 0; +} |