Update comstack example a bit
[yaz-moved-to-github.git] / doc / comstack.xml
index fe2d937..846b507 100644 (file)
     }
 
     server_address_ip = cs_straddr(stack, server_address_str);
-    if (!server_address_ip)
-    {
+    if (!server_address_ip) {
         fprintf(stderr, "cs_straddr: address could not be resolved\n");
         return -1;
     }
 
     status = cs_connect(stack, server_address_ip);
-    if (status != 0) {
+    if (status) {
         fprintf(stderr, "cs_connect: %s\n", cs_strerror(stack));
         return -1;
     }
 
+    status = cs_rcvconnect(stack);
+    if (status) {
+        fprintf(stderr, "cs_rcvconnect: %s\n", cs_strerror(stack));
+        return -1;
+    }
+
     status = cs_put(stack, protocol_package, protocol_package_length);
     if (status) {
         fprintf(stderr, "cs_put: %s\n", cs_strerror(stack));
         return -1;
     }
-    /* Now get a response */
 
+    /* Now get a response */
     length_incoming = cs_get(stack, &buf, &size);
     if (!length_incoming) {
         fprintf(stderr, "Connection closed\n");
@@ -54,7 +59,7 @@
     /* clean up */
     cs_close(stack);
     if (buf)
-        free(buf);
+        xfree(buf);
     return 0;
 ]]>
    </programlisting>
    </para>
 
    <para>
-    For TCP/IP and SSL transport modes, the special hostname &quot;@&quot;
-    is mapped to any local address
-    (the manifest constant <literal>INADDR_ANY</literal>).
-    It is used to establish local listening endpoints in the server role.
+    For TCP/IP and SSL, the special hostnames <literal>@</literal>,
+    maps to <literal>IN6ADDR_ANY_INIT</literal> with
+    IPV4 binding as well (bindv6only=0),
+    The special hostname <literal>@4</literal> binds to
+    <literal>INADDR_ANY</literal> (IPV4 only listener).
+    The special hostname <literal>@6</literal> binds to
+    <literal>IN6ADDR_ANY_INIT</literal> with bindv6only=1 (IPV6 only listener).
    </para>
 
    <para>
     function <function>cs_create</function>. The third parameter
     <parameter>vp</parameter> is a pointer to &comstack; stack type
     specific values.
-    For SSL (ssl_type) <parameter>vp</parameter> is an already create
-    OpenSSL CTX. For TCP/IP and UNIX <parameter>vp</parameter>
-    is unused (can be set to <literal>NULL</literal>.
+    Parameter <parameter>vp</parameter> is reserved for future use.
+    Set it to <literal>NULL</literal>.
    </para>
 
   </sect1>