summaryrefslogtreecommitdiffstats
path: root/test/echo-client.c
blob: 47d7314d6acefa2c63a8e47ce216ca3f1b82b097 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#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 ("org.freedesktop.DBus.Test", "org.freedesktop.DBus.Test");
  dbus_connection_send_message (connection,
                                message,
				NULL, 
                                NULL);
  dbus_message_unref (message);
  
  do_mainloop ();

  dbus_connection_unref (connection);
  
  return 0;
}