2 * $Id: zoomtst2.c,v 1.5 2002-12-09 23:32:29 adam Exp $
4 * Asynchronous single-target client performing search (no retrieval)
12 int main(int argc, char **argv)
17 const char *errmsg, *addinfo, *diagset;
21 fprintf (stderr, "usage:\n%s target query\n", *argv);
23 "Verify: asynchronous single-target client\n");
27 /* create connection (don't connect yet) */
28 z = ZOOM_connection_create(0);
30 /* option: set async operation */
31 ZOOM_connection_option_set (z, "async", "1");
33 /* connect to target and initialize */
34 ZOOM_connection_connect (z, argv[1], 0);
36 /* search using prefix query format */
37 r = ZOOM_connection_search_pqf (z, argv[2]);
39 /* block here: only one connection */
40 while (ZOOM_event (1, &z))
43 /* see if any error occurred */
44 if ((error = ZOOM_connection_error_x(z, &errmsg, &addinfo, &diagset)))
46 fprintf (stderr, "Error: %s: %s (%d) %s\n", diagset, errmsg, error,
50 else /* OK print hit count */
51 printf ("Result count: %d\n", ZOOM_resultset_size(r));
52 ZOOM_resultset_destroy (r);
53 ZOOM_connection_destroy (z);