diff options
Diffstat (limited to 'doc/tcp.html')
-rw-r--r-- | doc/tcp.html | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/doc/tcp.html b/doc/tcp.html index 34d6c6e..7a49660 100644 --- a/doc/tcp.html +++ b/doc/tcp.html | |||
@@ -241,18 +241,16 @@ method returns <b><tt>nil</tt></b> followed by an error message. | |||
241 | <!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 241 | <!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
242 | 242 | ||
243 | <p class=name id=receive> | 243 | <p class=name id=receive> |
244 | client:<b>receive(</b>[pattern<sub>1</sub>, pattern<sub>2</sub>, | 244 | client:<b>receive(</b>[pattern]<b>)</b> |
245 | ... pattern<sub>N</sub>]<b>)</b> | ||
246 | </p> | 245 | </p> |
247 | 246 | ||
248 | <p class=description> | 247 | <p class=description> |
249 | Reads data from a client object, according to the specified <em>read | 248 | Reads data from a client object, according to the specified <em>read |
250 | patterns</em>. Patterns follow the Lua file I/O format, and the difference in performance between all patterns is negligible. | 249 | pattern</em>. Patterns follow the Lua file I/O format, and the difference in performance between all patterns is negligible. |
251 | </p> | 250 | </p> |
252 | 251 | ||
253 | <p class=parameters> | 252 | <p class=parameters> |
254 | The parameters <tt>pattern</tt><sub>1</sub>, <tt>pattern</tt><sub>2</sub>, ... | 253 | <tt>Pattern</tt> can be any of the following: |
255 | <tt>pattern</tt><sub>N</sub> can be any of the following: | ||
256 | </p> | 254 | </p> |
257 | 255 | ||
258 | <ul> | 256 | <ul> |
@@ -267,16 +265,21 @@ of bytes from the socket. | |||
267 | </ul> | 265 | </ul> |
268 | 266 | ||
269 | <p class=return> | 267 | <p class=return> |
270 | The method returns one value for each pattern, followed by a single | 268 | If successful, the method returns the received pattern. In case of error, |
271 | error code that can be <b><tt>nil</tt></b> in case of success, the string | 269 | the method returns <tt><b>nil</b></tt> followed by an error message which |
272 | '<tt>closed</tt>' in case the connection was closed before the | 270 | can be the string '<tt>closed</tt>' in case the connection was |
273 | transmission was completed or the string '<tt>timeout</tt>' in case | 271 | closed before the transmission was completed or the string |
274 | there was a timeout during the operation. | 272 | '<tt>timeout</tt>' in case there was a timeout during the operation. |
273 | Also, after the error message, the function returns the partial result of | ||
274 | the transmission. | ||
275 | </p> | 275 | </p> |
276 | 276 | ||
277 | <p class=note> | 277 | <p class=note> |
278 | Note: In case of error, the method always return everything it managed | 278 | <b>Important note</b>: This function was changed <em>severely</em>. It used |
279 | to download before the error condition was met. | 279 | to support multiple patterns (but I have never seen this feature used) and |
280 | partial results used to be returned in the same way as successful results. | ||
281 | This last feature violated the idea that all functions should return | ||
282 | <tt><b>nil</b></tt> on error. Thus the change. | ||
280 | </p> | 283 | </p> |
281 | 284 | ||
282 | <!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 285 | <!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
@@ -428,7 +431,7 @@ client:<b>shutdown(</b>mode<b>)</b><br> | |||
428 | </p> | 431 | </p> |
429 | 432 | ||
430 | <p class=description> | 433 | <p class=description> |
431 | Shuts down part of a full duplex connection. | 434 | Shuts down part of a full-duplex connection. |
432 | </p> | 435 | </p> |
433 | 436 | ||
434 | <p class=parameters> | 437 | <p class=parameters> |