X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=doc%2Fyaz.sgml;h=8cb4577ca139c01df453a0f05558f7194fdc39b8;hb=d4b069b3c2525b7ae0fe3bf91c16c48d5cec100c;hp=12497a1cf92bdddd2a2fd17cbce5bd381ff165a1;hpb=5411affe4d00fc2d7bb4e8c907c53d4c085a44ce;p=yaz-moved-to-github.git diff --git a/doc/yaz.sgml b/doc/yaz.sgml index 12497a1..8cb4577 100644 --- a/doc/yaz.sgml +++ b/doc/yaz.sgml @@ -2,7 +2,7 @@
YAZ User's Guide and Reference <author><htmlurl url="http://www.indexdata.dk/" name="Index Data">, <tt><htmlurl url="mailto:info@indexdata.dk" name="info@indexdata.dk"></> -<date>$Revision: 1.7 $ +<date>$Revision: 1.10 $ <abstract> This document is the programmer's guide and reference to the YAZ package. YAZ is a compact toolkit that provides access to the @@ -2557,6 +2557,58 @@ what goes wrong. <sect>The COMSTACK Module<label id="comstack"> +<sect1>Synopsis (blocking mode) + +<p> + +<tscreen><verb> + +COMSTACK *stack; +char *buf = 0; +int size = 0, length_incoming; +char *protocol_package; +int protocol_package_length; +char server_address[] = "myserver.com:2100"; +int status; + +stack = cs_create(tcpip_type, 1, PROTO_Z3950); +if (!stack) { + perror("cs_create"); /* note use of perror() here since we have no stack yet */ + exit(1); +} + +status = cs_connect(stack, server_address); +if (status != 0) { + cs_perror(stack, "cs_connect"); + exit(1); +} + +status = cs_put(stack, protocol_package, protocol_package_length); +if (status) { + cs_perror(stack, "cs_put"); + exit(1); +} + +/* Now get a response */ + +length_incoming = cs_get(stack, &buf, &size); +if (!length_incoming) { + fprintf(stderr, "Connection closed\n"); + exit(1); +} else if (length_incoming < 0) { + cs_perror(stack, "cs_get"); + exit(1); +} + +/* Do stuff with buf here */ + +/* clean up */ +cs_close(stack); +if (buf) + free(buf); + +</verb></tscreen> + <sect1>Introduction <p> @@ -3786,7 +3838,7 @@ in general. <tscreen><verb> Index Data Aps -KĂžbmagergade 43 +Købmagergade 43 DK-1150 Copenhagen K </verb></tscreen>