blob: 64691c9d82f123288496077db32bb75f25e62e08 (
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
43
44
45
46
|
/*
* Simple manual tcp check
*
* supports:
* - server listening check
*
* syntax: manual-tcp [<ipv4>|<ipv6>]
*
*/
#include "config.h"
#include "dbus/dbus-server-socket.h"
#include <stdio.h>
int
main (int argc, char **argv)
{
DBusServer *server;
DBusError error;
int result = 0;
int i;
char *family = NULL;
if (argc == 2)
family = argv[1];
for (i = 0; i < 1000; i++)
{
dbus_error_init (&error);
server = _dbus_server_new_for_tcp_socket ("localhost", "localhost", "0", family, &error, FALSE);
if (server == NULL)
{
printf("%d: %s %s\n",i, error.name, error.message);
dbus_error_free(&error);
result = -1;
}
else {
printf("%d: %s \n",i, dbus_server_get_address(server));
dbus_server_disconnect(server);
dbus_server_unref(server);
}
}
return result;
}
|