aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/callback.html158
-rw-r--r--doc/dns.html19
-rw-r--r--doc/http.html2
-rw-r--r--doc/index.html18
-rw-r--r--doc/reference.html8
-rw-r--r--doc/tcp.html148
-rw-r--r--doc/url.html44
7 files changed, 319 insertions, 78 deletions
diff --git a/doc/callback.html b/doc/callback.html
index 94af8ff..98b4476 100644
--- a/doc/callback.html
+++ b/doc/callback.html
@@ -31,16 +31,16 @@
31<hr> 31<hr>
32</div> 32</div>
33 33
34<!-- stream ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 34<!-- stream ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
35 35
36<h2 id=stream>Streaming with Callbacks</h2> 36<h2 id=stream>Callbacks</h2>
37 37
38<p> 38<p>
39HTTP, FTP, and SMTP transfers sometimes involve large amounts of 39HTTP, FTP, and SMTP transfers sometimes involve large amounts of
40information. Sometimes an application needs to generate outgoing data 40information. Sometimes an application needs to generate outgoing data
41in real time, or needs to process incoming information as it is being 41in real time, or needs to process incoming information as it is being
42received. To address these problems, LuaSocket allows HTTP and SMTP message 42received. To address these problems, LuaSocket allows HTTP and SMTP message
43bodies and FTP file contents to be received or sent through the 43bodies and FTP file contents to be streamed through the
44callback mechanism outlined below. 44callback mechanism outlined below.
45</p> 45</p>
46 46
@@ -52,7 +52,7 @@ chunks of data, as the data becomes available. Conversely, the <em>send
52callback</em> mechanism can be used when the application wants to incrementally provide LuaSocket with the data to be sent. 52callback</em> mechanism can be used when the application wants to incrementally provide LuaSocket with the data to be sent.
53</p> 53</p>
54 54
55<!-- tohostname +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 55<!-- receive +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
56 56
57<p class=name id=receive> 57<p class=name id=receive>
58<b>receive_cb(</b>chunk, err<b>)</b> 58<b>receive_cb(</b>chunk, err<b>)</b>
@@ -60,7 +60,7 @@ callback</em> mechanism can be used when the application wants to incrementally
60 60
61<p class=description> 61<p class=description>
62A receive callback will be repeatedly called by 62A receive callback will be repeatedly called by
63LuaSocket wheneve new data is available. Each time it is called, the 63LuaSocket whenever new data is available. Each time it is called, the
64callback receives successive chunks of downloaded data. 64callback receives successive chunks of downloaded data.
65</p> 65</p>
66 66
@@ -113,10 +113,129 @@ Together, these two modules provide a powerful interface to send and
113receive information. 113receive information.
114</p> 114</p>
115 115
116<!-- done +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
117
118<p class=name id=done>
119socket.callback.<b>done()</b>
120</p>
121
122<p class=description>
123This function creates and returns a callback that successfully terminates
124the transmission.
125</p>
126
127<!-- fail +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
128
129<p class=name id=fail>
130socket.callback.<b>fail(</b>message<b>)</b>
131</p>
132
133<p class=description>
134This function creates and returns a callback that aborts the
135transmission with a given error <tt>message</tt>.
136</p>
137
138<!-- receive.concat +++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
139
140<p class=name id=receive.concat>
141socket.callback.<b>receive.concat(</b>cat<b>)</b>
142</p>
143
144<p class=description>
145This function creates a receive callback that stores whatever it receives
146into a concat object. When done, the application can get the contents
147received as a single string, directly from the concat object.
148</p>
149
150<p class=parameters>
151<tt>Cat</tt> is the target concat object, or <b><tt>nil</tt></b>.
152If <tt>cat</tt> is <b><tt>nil</tt></b>, the function creates its own
153concat object.
154</p>
155
156<p class=return>
157The function returns a receive callback for the file, and the concat object
158that will be used to store the received contents.
159</p>
160
161<!-- receive.file +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
162
163<p class=name id=receive.file>
164socket.callback.<b>receive.file(</b>file, io_err<b>)</b>
165</p>
166
167<p class=description>
168This function creates a receive callback that stores whatever it receives
169into a file. When done, the callback closes the file.
170</p>
171
172<p class=parameters>
173<tt>File</tt> is a file handle opened for writing. If <tt>file</tt> is
174<b><tt>nil</tt></b>, <tt>io_err</tt> can contain an error message. In this
175case, the function returns a callback that just aborts
176transmission with the error message.
177</p>
178
179<p class=return>
180The function returns a receive callback for the file.
181</p>
182
183<p class=note>
184Note: This function is designed so that it directly accepts the return
185values of Lua's IO <tt>io.open</tt> library function.
186</p>
187
188<!-- receive.chain ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
189
190<p class=name id=receive.chain>
191socket.callback.<b>receive.chain(</b>filter, receive_cb<b>)</b>
192</p>
193
194<p class=description>
195This function creates a receive callback that passes all received data
196through a filter, before handing it to a given receive callback.
197</p>
198
199<p class=parameters>
200<tt>Cat</tt> is the target concat object, or <b><tt>nil</tt></b>.
201If <tt>cat</tt> is <b><tt>nil</tt></b>, the function creates its own
202concat object.
203</p>
204
205<p class=return>
206The function returns a receive callback for the file, and the concat object
207that will be used to store the received contents.
208</p>
209
210<p class=note>
211Note: Several filters are defined in the <a href=mime.html>MIME</a>
212module. Below is an example that creates a receive callback that
213creates a string from the received contents, after decoding the
214Quoted-Printable transfer content encoding.
215</p>
216
217<pre class=example>
218string_cb, concat = socket.callback.receive.concat()
219receive_cb = socket.callback.receive.chain(
220 socket.mime.decode("quoted-printable"),
221 string_cb
222)
223</pre>
224
225<p class=note>
226The call to <tt>callback.chain</tt> creates a chained
227receive callback that decodes data using the
228<tt><a href=mime.html#decode>mime.decode</a></tt>
229Quoted-Printable MIME filter and
230hands the decoded data to a concat receive callback.
231The concatenated decoded data can be retrieved later
232from the associated concat object.
233</p>
234
116<!-- send.file ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 235<!-- send.file ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
117 236
118<p class=name id=send.file> 237<p class=name id=send.file>
119<b>send.file</b>(file, io_err<b>)</b> 238socket.callback.<b>send.file(</b>file, io_err<b>)</b>
120</p> 239</p>
121 240
122<p class=description> 241<p class=description>
@@ -126,25 +245,25 @@ When done, the callback closes the file.
126</p> 245</p>
127 246
128<p class=parameters> 247<p class=parameters>
129<tt>File</tt> is a file opened for reading. If <tt>file</tt> is 248<tt>File</tt> is a file handle opened for reading. If <tt>file</tt> is
130<b><tt>nil</tt></b>, <tt>io_err</tt> can contain an error message. In this 249<b><tt>nil</tt></b>, <tt>io_err</tt> can contain an error message. In this
131case, the function returns a callback that just aborts 250case, the function returns a callback that just aborts
132transmission with the error message. 251transmission with the error message.
133</p> 252</p>
134 253
135<p class=return> 254<p class=return>
136Returns a send callback for the file. 255The function returns a send callback for the file.
137</p> 256</p>
138 257
139<p class=note> 258<p class=note>
140Note: This function is designed so that it directly accepts the return 259Note: This function is designed so that it directly accepts the return
141values of the <tt>io.open</tt> function. 260values of Lua's IO <tt>io.open</tt> library function.
142</p> 261</p>
143 262
144<!-- send.string ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 263<!-- send.string ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
145 264
146<p class=name id=send.string> 265<p class=name id=send.string>
147<b>send.string(</b>str, err<b>)</b> 266socket.callback.<b>send.string(</b>str, err<b>)</b>
148</p> 267</p>
149 268
150<p class=description> 269<p class=description>
@@ -154,26 +273,17 @@ the contents of a string.
154 273
155<p class=parameters> 274<p class=parameters>
156<tt>Str</tt> is the string to be sent. 275<tt>Str</tt> is the string to be sent.
157<!--
158If <tt>str</tt> is
159<b><tt>nil</tt></b>, <tt>err</tt> can optionally contain an error message.
160-->
161</p> 276</p>
162 277
163<p class=return> 278<p class=return>
164Returns a send callback for the string, or <b><tt>nil</tt></b> if the string is 279It returns a send callback for the string,
165<b><tt>nil</tt></b>. 280or <b><tt>nil</tt></b> if <tt>str</tt> is <b><tt>nil</tt></b>.
166</p>
167
168<p class=note>
169Note: A <tt>nil</tt></b>
170send callback is equivalent to a callback that returns the empty string.
171</p> 281</p>
172 282
173<!-- send.chain ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 283<!-- send.chain ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
174 284
175<p class=name id=send.chain> 285<p class=name id=send.chain>
176<b>send.chain(</b>send_cb, filter<b>)</b> 286socket.callback.<b>send.chain(</b>send_cb, filter<b>)</b>
177</p> 287</p>
178 288
179<p class=description> 289<p class=description>
@@ -207,9 +317,9 @@ send_cb = socket.callback.send.chain(
207</pre> 317</pre>
208 318
209<p class=note> 319<p class=note>
210The call to <a href=mime.html#chain><tt>socket.mime.chain</tt></a> 320The call to <a href=mime.html#chain><tt>mime.chain</tt></a>
211creates a chained filter that encodes it's input and then breaks it 321creates a chained filter that encodes it's input and then breaks it
212into lines. The call to <tt>socket.callback.chain</tt> creates a chained 322into lines. The call to <tt>callback.chain</tt> creates a chained
213send callback that reads the file from disk and passes it through the 323send callback that reads the file from disk and passes it through the
214filter before sending it. 324filter before sending it.
215</p> 325</p>
diff --git a/doc/dns.html b/doc/dns.html
index 17cee45..71a9719 100644
--- a/doc/dns.html
+++ b/doc/dns.html
@@ -36,8 +36,7 @@
36<h2 id=dns>DNS</h2> 36<h2 id=dns>DNS</h2>
37 37
38<p> 38<p>
39The following functions can be used to convert between host names and IP 39Name resolution function return <em>all</em> information returned by the
40addresses. Both functions return <em>all</em> information returned by the
41resolver in a table of the form: 40resolver in a table of the form:
42</p> 41</p>
43 42
@@ -53,6 +52,21 @@ resolved = {<br>
53Note that the <tt>alias</tt> list can be empty. 52Note that the <tt>alias</tt> list can be empty.
54</p> 53</p>
55 54
55<!-- gethostname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
56
57<p class=name id=gethostname>
58socket.dns.<b>gethostname()</b>
59</p>
60
61<p class=description>
62Returns the standard host name for the machine.
63</p>
64
65<p class=return>
66The function returns a string with the host name.
67</p>
68
69
56<!-- tohostname +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 70<!-- tohostname +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
57 71
58<p class=name id=tohostname> 72<p class=name id=tohostname>
@@ -74,7 +88,6 @@ the resolver. In case of error, the function returns <b><tt>nil</tt></b>
74followed by an error message. 88followed by an error message.
75</p> 89</p>
76 90
77
78<!-- toip +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 91<!-- toip +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
79 92
80<p class=name id=toip> 93<p class=name id=toip>
diff --git a/doc/http.html b/doc/http.html
index f977ea9..f82f515 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -49,7 +49,7 @@ implementation conforms to the HTTP/1.1 standard,
49The module exports functions that provide HTTP functionality in different 49The module exports functions that provide HTTP functionality in different
50levels of abstraction, from a simple <a 50levels of abstraction, from a simple <a
51href="#get"><tt>get</tt></a>, to the generic, stream oriented 51href="#get"><tt>get</tt></a>, to the generic, stream oriented
52<a href="#request_cb"> <tt>request_cb</tt></a>. 52<a href="#request_cb"><tt>request_cb</tt></a>.
53</p> 53</p>
54 54
55<p> 55<p>
diff --git a/doc/index.html b/doc/index.html
index 620f385..a2c2d59 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -40,7 +40,8 @@ LuaSocket is a <a href="http://www.lua.org">Lua</a> extension library
40that is composed by two parts: a C layer that provides support for the TCP 40that is composed by two parts: a C layer that provides support for the TCP
41and UDP transport layers, and a set of Lua modules that add support for 41and UDP transport layers, and a set of Lua modules that add support for
42the SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and 42the SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and
43downloading files) protocols. 43downloading files) protocols and other functionality commonly needed by
44applications that deal with the Internet.
44</p> 45</p>
45 46
46<p> 47<p>
@@ -106,10 +107,25 @@ This binary has been compiled with the <tt>LUASOCKET_DEBUG</tt>
106option, and should be able to run the automatic test procedures. 107option, and should be able to run the automatic test procedures.
107</p> 108</p>
108 109
110<!-- thanks +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
111
112<h2 id=thanks>Special thanks</h2>
113
114<p>
115Throughout LuaSocket its history, many people gave sugestions that helped
116improve it. For that, I thank the Lua comunity.
117Special thanks go to
118David Burgess, who has pushed the library to a new level of quality and
119from whom I have learned a lot stuff that doesn't show up in RFCs.
120Special thanks also to Carlos Cassino, who played a big part in the
121extensible design seen in the C core of LuaSocket 2.0.
122</p>
123
109<!-- whatsnew +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 124<!-- whatsnew +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
110 125
111<h2 id=new>What's New</h2> 126<h2 id=new>What's New</h2>
112 127
128
113<p> 129<p>
114Most of the changes for 2.0 happened in the C layer, which 130Most of the changes for 2.0 happened in the C layer, which
115has been almost completely rewritten. The code has been ported to Lua 5.0 131has been almost completely rewritten. The code has been ported to Lua 5.0
diff --git a/doc/reference.html b/doc/reference.html
index 0bfd378..e6efb6e 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -40,6 +40,10 @@
40<blockquote> 40<blockquote>
41<a href="callback.html">Callbacks (socket.callback)</a> 41<a href="callback.html">Callbacks (socket.callback)</a>
42<blockquote> 42<blockquote>
43<a href="callback.html#done">done</a>,
44<a href="callback.html#fail">fail</a>.
45</blockquote>
46<blockquote>
43<a href="callback.html#send">send</a>: 47<a href="callback.html#send">send</a>:
44<a href="callback.html#send.chain">chain</a>, 48<a href="callback.html#send.chain">chain</a>,
45<a href="callback.html#send.file">file</a>, 49<a href="callback.html#send.file">file</a>,
@@ -121,7 +125,7 @@
121<blockquote> 125<blockquote>
122<a href="mime.html">MIME (socket.mime) </a> 126<a href="mime.html">MIME (socket.mime) </a>
123<blockquote> 127<blockquote>
124<a href="mime.html#filters">filters</a>: 128<a href="mime.html#high">high-level</a>:
125<a href="mime.html#decode">canonic</a>, 129<a href="mime.html#decode">canonic</a>,
126<a href="mime.html#chain">chain</a>, 130<a href="mime.html#chain">chain</a>,
127<a href="mime.html#decode">decode</a>, 131<a href="mime.html#decode">decode</a>,
@@ -129,7 +133,7 @@
129<a href="mime.html#wrap">wrap</a>. 133<a href="mime.html#wrap">wrap</a>.
130</blockquote> 134</blockquote>
131<blockquote> 135<blockquote>
132<a href="mime.html#low-level">low-level</a>: 136<a href="mime.html#low">low-level</a>:
133<a href="mime.html#b64">b64</a>, 137<a href="mime.html#b64">b64</a>,
134<a href="mime.html#unb64">unb64</a>, 138<a href="mime.html#unb64">unb64</a>,
135<a href="mime.html#eol">eol</a>, 139<a href="mime.html#eol">eol</a>,
diff --git a/doc/tcp.html b/doc/tcp.html
index eb4cdfa..34d6c6e 100644
--- a/doc/tcp.html
+++ b/doc/tcp.html
@@ -44,10 +44,11 @@ socket.<b>tcp()</b>
44<p class=description> 44<p class=description>
45Creates and returns a TCP master object. A master object can 45Creates and returns a TCP master object. A master object can
46be transformed into a server object with the method 46be transformed into a server object with the method
47<a href=#bind><tt>bind</tt></a> or into a client object with the method 47<a href=#listen><tt>listen</tt></a> (after a call to <a
48<a href=#connect><tt>connect</tt></a>. The only other method 48href=#bind><tt>bind</tt></a>) or into a client object with
49supported by a master object is the <a href=#close><tt>close</tt></a> 49the method <a href=#connect><tt>connect</tt></a>. The only other
50method.</p> 50method supported by a master object is the
51<a href=#close><tt>close</tt></a> method.</p>
51 52
52<p class=return> 53<p class=return>
53In case of success, a new master object is returned. In case of error, 54In case of success, a new master object is returned. In case of error,
@@ -67,8 +68,9 @@ object and returns a client object representing that connection.
67 68
68<p class=return> 69<p class=return>
69If a connection is successfully initiated, a client object is returned. 70If a connection is successfully initiated, a client object is returned.
70If a timeout condition is met, the method returns <b><tt>nil</tt></b> followed 71If a timeout condition is met, the method returns <b><tt>nil</tt></b>
71by the error string '<tt>timeout</tt>'. 72followed by the error string '<tt>timeout</tt>'. Other errors are
73reported by <b><tt>nil</tt></b> followed by a message describing the error.
72</p> 74</p>
73 75
74<p class=note> 76<p class=note>
@@ -77,25 +79,18 @@ with a server object in
77the <tt>receive</tt> parameter before a call to <tt>accept</tt> does 79the <tt>receive</tt> parameter before a call to <tt>accept</tt> does
78<em>not</em> guarantee <tt>accept</tt> will return immediately. Use the <a 80<em>not</em> guarantee <tt>accept</tt> will return immediately. Use the <a
79href=#settimeout><tt>settimeout</tt></a> method or <tt>accept</tt> 81href=#settimeout><tt>settimeout</tt></a> method or <tt>accept</tt>
80might block until <em>another</em> client shows up. 82might block until <em>another</em> client shows up.
81</p> 83</p>
82 84
83<!-- bind +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 85<!-- bind +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
84 86
85<p class=name id=bind> 87<p class=name id=bind>
86master:<b>bind(</b>address, port [, backlog]<b>)</b> 88master:<b>bind(</b>address, port<b>)</b>
87</p> 89</p>
88 90
89<p class=description> 91<p class=description>
90Binds a master object to <tt>address</tt> and <tt>port</tt> on the 92Binds a master object to <tt>address</tt> and <tt>port</tt> on the
91local host, transforming it into a server object. Server 93local host.
92objects support the
93<a href=#accept><tt>accept</tt></a>,
94<a href=#getsockname><tt>getsockname</tt></a>,
95<a href=#setoption><tt>setoption</tt></a>,
96<a href=#settimeout><tt>settimeout</tt></a>,
97and <a href=#close><tt>close</tt></a> methods.
98</p>
99 94
100<p class=parameters> 95<p class=parameters>
101<tt>Address</tt> can be an IP address or a host name. 96<tt>Address</tt> can be an IP address or a host name.
@@ -103,10 +98,7 @@ and <a href=#close><tt>close</tt></a> methods.
103If <tt>address</tt> 98If <tt>address</tt>
104is '<tt>*</tt>', the system binds to all local interfaces 99is '<tt>*</tt>', the system binds to all local interfaces
105using the <tt>INADDR_ANY</tt> constant. If <tt>port</tt> is 0, the system automatically 100using the <tt>INADDR_ANY</tt> constant. If <tt>port</tt> is 0, the system automatically
106chooses an ephemeral port. The optional parameter <tt>backlog</tt>, which 101chooses an ephemeral port.
107defaults to 1, specifies the number of client connections that can
108be queued waiting for service. If the queue is full and another client
109attempts connection, the connection is refused.
110</p> 102</p>
111 103
112<p class=return> 104<p class=return>
@@ -115,8 +107,8 @@ method returns <b><tt>nil</tt></b> followed by an error message.
115</p> 107</p>
116 108
117<p class=note> 109<p class=note>
118Note: The function <tt>socket.bind</tt> is available and is a short 110Note: The function <a href=#socket.bind><tt>socket.bind</tt></a>
119for <a href=#socket.tcp><tt>socket.tcp</tt></a> followed by the <tt>bind</tt> method. 111is available and is a shortcut for the creation server sockets.
120</p> 112</p>
121 113
122<!-- close ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 114<!-- close ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -150,7 +142,8 @@ master:<b>connect(</b>address, port<b>)</b>
150 142
151<p class=description> 143<p class=description>
152Attempts to connect a master object to a remote host, transforming it into a 144Attempts to connect a master object to a remote host, transforming it into a
153client object. Client objects support methods 145client object.
146Client objects support methods
154<a href=#send><tt>send</tt></a>, 147<a href=#send><tt>send</tt></a>,
155<a href=#receive><tt>receive</tt></a>, 148<a href=#receive><tt>receive</tt></a>,
156<a href=#getsockname><tt>getsockname</tt></a>, 149<a href=#getsockname><tt>getsockname</tt></a>,
@@ -170,8 +163,15 @@ describing the error. In case of success, the method returns 1.
170</p> 163</p>
171 164
172<p class=note> 165<p class=note>
173Note: The function <tt>socket.connect</tt> is available and is a short 166Note: The function <a href=#socket.connect><tt>socket.connect</tt></a>
174for <a href=#socket.tcp><tt>socket.tcp</tt></a> followed by the <tt>connect</tt> method. 167is available and is a shortcut for the creation of client sockets.
168</p>
169
170<p class=note>
171Note: Starting with LuaSocket 2.0,
172the <a href=#settimeout><tt>settimeout</tt></a>
173function affects the behavior of connect, causing it to return in case of
174a timeout error.
175</p> 175</p>
176 176
177<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 177<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -210,12 +210,32 @@ The method returns a string with local IP address and a number with
210the port. In case of error, the method returns <b><tt>nil</tt></b>. 210the port. In case of error, the method returns <b><tt>nil</tt></b>.
211</p> 211</p>
212 212
213<p class=note> 213<!-- listen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
214Note: Naturally, for a server object, the address and port returned are 214
215those passed to the <a href=#bind>bind</a> method. If the port value 215<p class=name id=listen>
216passed to bind was 0, the OS assigned ephemeral port is returned. For 216master:<b>listen(</b>backlog<b>)</b>
217client objects, both the address and port are ephemeral and these are the 217</p>
218values returned. 218
219<p class=description>
220Specifies the socket is willing to receive connections, transforming the
221object into a server object. Server objects support the
222<a href=#accept><tt>accept</tt></a>,
223<a href=#getsockname><tt>getsockname</tt></a>,
224<a href=#setoption><tt>setoption</tt></a>,
225<a href=#settimeout><tt>settimeout</tt></a>,
226and <a href=#close><tt>close</tt></a> methods.
227</p>
228
229<p class=parameters>
230The parameter <tt>backlog</tt> specifies the number of client
231connections that can
232be queued waiting for service. If the queue is full and another client
233attempts connection, the connection is refused.
234</p>
235
236<p class=return>
237In case of success, the method returns 1. In case of error, the
238method returns <b><tt>nil</tt></b> followed by an error message.
219</p> 239</p>
220 240
221<!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 241<!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -242,8 +262,8 @@ closed. No end-of-line translation is performed;
242terminated by a LF character (ASCII&nbsp;10), optionally preceded by a 262terminated by a LF character (ASCII&nbsp;10), optionally preceded by a
243CR character (ASCII&nbsp;13). The CR and LF characters are not included in 263CR character (ASCII&nbsp;13). The CR and LF characters are not included in
244the returned line. This is the default pattern; 264the returned line. This is the default pattern;
245<li> <tt>number</tt>: causes the method to read <tt>number</tt> raw 265<li> <tt>number</tt>: causes the method to read a specified <tt>number</tt>
246bytes from the socket. 266of bytes from the socket.
247</ul> 267</ul>
248 268
249<p class=return> 269<p class=return>
@@ -311,22 +331,30 @@ are sure you need it.
311depends on the option being set: 331depends on the option being set:
312 332
313<ul> 333<ul>
314<li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt> disables the 334
315Nagle's algorithm for the connection; 335<li> '<tt>keepalive</tt>': Setting this option to <tt>true</tt> enables
336the periodic transmission of messages on a connected socket. Should the
337connected party fail to respond to these messages, the connection is
338considered broken and processes using the socket are notified;
339
316<li> '<tt>linger</tt>': Controls the action taken when unsent data are 340<li> '<tt>linger</tt>': Controls the action taken when unsent data are
317queued on a socket and a close is performed. The value is a table with a 341queued on a socket and a close is performed. The value is a table with a
318boolean entry '<tt>on</tt>' and a numeric entry for the time interval 342boolean entry '<tt>on</tt>' and a numeric entry for the time interval
319'<tt>timeout</tt>' in seconds. 343'<tt>timeout</tt>' in seconds. If the '<tt>on</tt>' field is set to
320 If the '<tt>on</tt>' field is set to <tt>true</tt>, 344<tt>true</tt>, the system will block the process on the close attempt until
321the system will block the process on the close attempt until it is able to 345it is able to transmit the data or until '<tt>timeout</tt>' has passed. If
322transmit the data or until '<tt>timeout</tt>' has passed. If '<tt>on</tt>' 346'<tt>on</tt>' is <tt>false</tt> and a close is issued, the system will
323is <tt>false</tt> and a close is issued, the system will process the close 347process the close in a manner that allows the process to continue as
324in a manner that allows the process to continue as quickly as possible. I 348quickly as possible. I do not advise you to set this to anything other than
325do not advise you to set this to anything other than zero. 349zero;
326<li> '<tt>keepalive</tt>': Setting this option to <tt>true</tt> enables 350
327the periodic transmission of messages on a connected socket. Should the 351<li> '<tt>reuseaddr</tt>': Setting this option indicates that the rules
328 connected party fail to respond to these messages, the connection is 352used in validating addresses supplied in a call to
329considered broken and processes using the socket are notified. 353<a href=#bind><tt>bind</tt></a> should allow reuse of local addresses;
354
355<li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt>
356disables the Nagle's algorithm for the connection.
357
330</ul> 358</ul>
331 359
332<p class=return> 360<p class=return>
@@ -382,7 +410,9 @@ indefinitely. Negative timeout values have the same effect.
382Note: although timeout values have millisecond precision in LuaSocket, 410Note: although timeout values have millisecond precision in LuaSocket,
383large blocks can cause I/O functions not to respect timeout values due 411large blocks can cause I/O functions not to respect timeout values due
384to the time the library takes to transfer blocks to and from the OS 412to the time the library takes to transfer blocks to and from the OS
385and to and from the Lua interpreter. 413and to and from the Lua interpreter. Also, function that accept host names
414and perform automatic name resolution might be blocked by the resolver for
415longer than the specified timeout value.
386</p> 416</p>
387 417
388<p class=note> 418<p class=note>
@@ -391,6 +421,30 @@ changed for sake of uniformity, since all other method names already
391contained verbs making their imperative nature obvious. 421contained verbs making their imperative nature obvious.
392</p> 422</p>
393 423
424<!-- shutdown +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
425
426<p class=name id=shutdown>
427client:<b>shutdown(</b>mode<b>)</b><br>
428</p>
429
430<p class=description>
431Shuts down part of a full duplex connection.
432</p>
433
434<p class=parameters>
435Mode tells which way of the connection should be shut down and can
436take the value:
437<ul>
438<li>"<tt>both</tt>": disallow further sends and receives on the object.
439This is the default mode;
440<li>"<tt>send</tt>": disallow further sends on the object;
441<li>"<tt>receive</tt>": disallow further receives on the object.
442</ul>
443
444<p class=return>
445This function returns 1.
446</p>
447
394<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 448<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
395 449
396<div class=footer> 450<div class=footer>
diff --git a/doc/url.html b/doc/url.html
index 0eafafa..f3a7cb7 100644
--- a/doc/url.html
+++ b/doc/url.html
@@ -241,6 +241,50 @@ returning a list with all the parsed segments, the function unescapes all
241of them. 241of them.
242</p> 242</p>
243 243
244<!-- escape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
245
246<p class=name id="escape">
247socket.url.<b>escape(</b>content<b>)</b>
248</p>
249
250<p class=description>
251Applies the URL escaping content coding to a string
252Each byte is encoded as a percent character followed
253by the two byte hexadecimal representation of its integer
254value.
255</p>
256
257<p class=parameters>
258<tt>Content</tt> is the string to be encoded.
259</p>
260
261<p class=result>
262The function returns the encoded string.
263</p>
264
265<pre class=example>
266code = socket.url.escape("/#?;")
267-- code = "%2f%23%3f%3b"
268</pre>
269
270<!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
271
272<p class=name id="unescape">
273socket.url.<b>unescape(</b>content<b>)</b>
274</p>
275
276<p class=description>
277Removes the URL escaping content coding from a string.
278</p>
279
280<p class=parameters>
281<tt>Content</tt> is the string to be decoded.
282</p>
283
284<p class=return>
285The function returns the decoded string.
286</p>
287
244<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 288<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
245 289
246<div class=footer> 290<div class=footer>