1 /* $Id: zoom-ka.c,v 1.1 2006-09-19 19:41:32 adam Exp $ */
4 \brief Test ZOOM Keepalive / reconnect
11 #include <yaz/wrbuf.h>
14 #include <yaz/xmalloc.h>
17 int main(int argc, char **argv)
20 ZOOM_options o = ZOOM_options_create ();
21 const char *errmsg, *addinfo;
25 fprintf (stderr, "usage:\nzoom-ka sleepinterval target query\n");
29 ZOOM_options_set (o, "async", "1");
31 z = ZOOM_connection_create(o);
37 ZOOM_connection_connect (z, argv[2], 0);
38 rset = ZOOM_connection_search_pqf(z, argv[3]);
40 while ((i = ZOOM_event(1, &z)))
42 printf ("no = %d event = %d\n", i-1,
43 ZOOM_connection_last_event(z));
45 if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
47 fprintf(stderr, "%s error: %s (%d) %s\n",
48 ZOOM_connection_option_get(z, "host"),
49 errmsg, error, addinfo);
51 ZOOM_resultset_destroy(rset);
54 ZOOM_connection_destroy (z);
55 ZOOM_options_destroy(o);
60 * indent-tabs-mode: nil
62 * vim: shiftwidth=4 tabstop=8 expandtab