1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>5.Server Side</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="YAZ User's Guide and Reference"><link rel="up" href="comstack.html" title="Chapter9.The COMSTACK Module"><link rel="prev" href="comstack.client.html" title="4.Client Side"><link rel="next" href="comstack.addresses.html" title="6.Addresses"></head><body><link rel="stylesheet" type="text/css" href="common/style1.css"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.Server Side</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="comstack.client.html">Prev</a></td><th width="60%" align="center">Chapter9.The COMSTACK Module</th><td width="20%" align="right"><a accesskey="n" href="comstack.addresses.html">Next</a></td></tr></table><hr></div><div class="sect1" title="5.Server Side"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="comstack.server"></a>5.Server Side</h2></div></div></div><p>
To establish a server under the <span class="application">inetd</span>
server, you can use
</p><pre class="synopsis">
COMSTACK cs_createbysocket(int socket, CS_TYPE type, int blocking,
int protocol);
</pre><p>
The <code class="literal">socket</code> parameter is an established socket (when
your application is invoked from <span class="application">inetd</span>, the
socket will typically be 0.
The following parameters are identical to the ones for
<code class="function">cs_create</code>.
</p><pre class="synopsis">
int cs_bind(COMSTACK handle, void *address, int mode)
</pre><p>
Binds a local address to the endpoint. Read about addresses below. The
<code class="literal">mode</code> parameter should be either
<code class="literal">CS_CLIENT</code> or <code class="literal">CS_SERVER</code>.
</p><pre class="synopsis">
int cs_listen(COMSTACK handle, char *addr, int *addrlen);
</pre><p>
Call this to process incoming events on an endpoint that has been
bound in listening mode. It will return 0 to indicate that the connect
request has been received, 1 to signal a partial reception, and -1 to
indicate an error condition.
</p><pre class="synopsis">
COMSTACK cs_accept(COMSTACK handle);
</pre><p>
This finalizes the server-side association establishment, after
cs_listen has completed successfully. It returns a new connection
endpoint, which represents the new association. The application will
typically wish to fork off a process to handle the association at this
point, and continue listen for new connections on the old
<code class="literal">handle</code>.
</p><p>
You can use the call
</p><pre class="synopsis">
const char *cs_addrstr(COMSTACK);
</pre><p>
on an established connection to retrieve the host-name of the remote host.
</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>You may need to use this function with some care if your
name server service is slow or unreliable
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="comstack.client.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="comstack.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="comstack.addresses.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.Client Side</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">6.Addresses</td></tr></table></div></body></html>
|