2 * $Id: zoomtst2.c,v 1.1 2001-10-23 21:00:20 adam Exp $
4 * Asynchronous single-target client performing search (no retrieval)
12 int main(int argc, char **argv)
17 const char *errmsg, *addinfo;
21 fprintf (stderr, "usage:\n%s target query\n", *argv);
23 "Verify: aasynchronous single-target client\n");
27 /* create connection (don't connect yet) */
28 z = Z3950_connection_create(0);
30 /* option: set async operation */
31 Z3950_connection_option (z, "async", "1");
33 /* connect to target and initialize */
34 Z3950_connection_connect (z, argv[1], 0);
36 /* search using prefix query format */
37 r = Z3950_connection_search_pqf (z, argv[2]);
39 /* block here: only one connection */
40 while (Z3950_event (1, &z))
43 /* see if any error occurred */
44 if ((error = Z3950_connection_error(z, &errmsg, &addinfo)))
46 fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
49 else /* OK print hit count */
50 printf ("Result count: %d\n", Z3950_resultset_size(r));
51 Z3950_resultset_destroy (r);
52 Z3950_connection_destroy (z);