/usr/share/doc/liblua5.1-copas-dev/us/reference.html is in liblua5.1-copas-dev 1.1.5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Copas - Coroutine Oriented Portable Asynchronous Services for Lua</title>
<link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"><a href="http://www.keplerproject.org">
<img alt="Copas logo" src="copas.png"/>
</a></div>
<div id="product_name"><big><strong>Copas</strong></big></div>
<div id="product_description">Coroutine Oriented Portable Asynchronous Services for Lua</div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<h1>Copas</h1>
<ul>
<li><a href="index.html">Home</a>
<ul>
<li><a href="index.html#over">Overview</a></li>
<li><a href="index.html#status">Status</a></li>
<li><a href="index.html#download">Download</a></li>
<li><a href="index.html#dependencies">Dependencies</a></li>
<li><a href="index.html#history">History</a></li>
<li><a href="index.html#credits">Credits</a></li>
<li><a href="index.html#contact">Contact us</a></li>
</ul>
</li>
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#install">Installing</a></li>
<li><a href="manual.html#introduction">Introduction</a></li>
<li><a href="manual.html#why">Why use Copas?</a></li>
<li><a href="manual.html#using">Using Copas</a></li>
<li><a href="manual.html#control">Controlling Copas</a></li>
</ul>
</li>
<li><strong>Reference</strong></li>
<li><a href="http://luaforge.net/projects/copas/">Project</a>
<ul>
<li><a href="http://luaforge.net/tracker/?group_id=100">Bug Tracker</a></li>
<li><a href="http://luaforge.net/scm/?group_id=100">CVS</a></li>
</ul>
</li>
<li><a href="license.html">License</a></li>
</ul>
</div> <!-- id="navigation" -->
<div id="content">
<h2>Reference</h2>
<p>
Copas functions are separated in two groups.</p>
<p>
The first group is relative to the use of the dispatcher itself and
are used to register servers and to execute the main loop of Copas:</p>
<dl class="reference">
<dt><strong><code>copas.addserver(server, handler[, timeout])</code></strong></dt>
<dd>Adds a new <code>server</code> and its <code>handler</code> to the dispatcher
using an optional <code>timeout</code>.<br />
<code>server</code> is a LuaSocket server socket created using
<code>socket.bind()</code>.<br />
<code>handler</code> is a function that receives a LuaSocket client socket
and handles the communication with that client.<br />
<code>timeout</code> is the timeout for blocking I/O in seconds.
The handler will be executed in parallel with other threads and the
registered handlers as long as it uses the Copas socket functions.
</dd>
<dt><strong><code>copas.addthread(thrd[, ...])</code></strong></dt>
<dd>Adds a new thread to the dispatcher using optional parameters.<br />
The thread will be executed in parallel with other threads and the
registered handlers as long as it uses the Copas socket functions.
</dd>
<dt><strong><code>copas.loop(timeout)</code></strong></dt>
<dd>Starts the Copas infinite loop accepting client connections for the
registered servers and handling those connections with the corresponding
handlers. Every time a server accepts a connection, Copas calls the
associated handler passing the client socket returned by
<code>socket.accept()</code>. The <code>timeout</code> parameter is optional.
</dd>
<dt><strong><code>copas.step(timeout)</code></strong></dt>
<dd>Executes one copas iteration accepting client connections for the
registered servers and handling those connections with the corresponding
handlers. When a server accepts a connection, Copas calls the
associated handler passing the client socket returned by
<code>socket.accept()</code>. The <code>timeout</code> parameter is optional.
</dd>
</dl>
<p>The second group is used by the handler functions to exchange data with
the clients, and by threads registered with <code>addthread</code> to
exchange data with other services.</p>
<dl class="reference">
<dt><strong><code>copas.flush(skt)</code></strong></dt>
<dd>Flushes a client write buffer. <code>copas.flush()</code> is called from time
to time by <code>copas.loop()</code> but it may be necessary to call it from
the handler function or one of the threads.
</dd>
<dt><strong><code>copas.receive(skt, pattern)</code></strong></dt>
<dd>Reads data from a client socket according to a pattern just like LuaSocket
<code>socket:receive()</code>. The Copas version does not block and allows
the multitasking of the other handlers and threads.
</dd>
<dt><strong><code>copas.send(skt, data)</code></strong></dt>
<dd>Sends data to a client socket just like <code>socket:send()</code>. The Copas version
is buffered and does not block, allowing the multitasking of the other handlers and threads.
</dd>
<dt><strong><code>copas.wrap(skt)</code></strong></dt>
<dd>Wraps a LuaSocket socket and returns a Copas socket that implements LuaSocket's API
but use Copas' methods <code>copas.send()</code> and <code>copas.receive()</code>
automatically.
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
<p><small>$Id: reference.html,v 1.16 2009/04/07 21:34:52 carregal Exp $</small></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
|