diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-11-24 20:29:28 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-11-24 20:29:28 +0000 |
commit | 96da86a81f0f37961851ead62404c255293eebdf (patch) | |
tree | c8c118109360b6d4696c5535f7b902301909e802 | |
parent | 7dace4af7e2f0235a49fa64b47b13c50691baddb (diff) | |
download | luasocket-96da86a81f0f37961851ead62404c255293eebdf.tar.gz luasocket-96da86a81f0f37961851ead62404c255293eebdf.tar.bz2 luasocket-96da86a81f0f37961851ead62404c255293eebdf.zip |
Simplified documentation of send().
-rw-r--r-- | doc/tcp.html | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/doc/tcp.html b/doc/tcp.html index 5814e1a..39fa6b7 100644 --- a/doc/tcp.html +++ b/doc/tcp.html | |||
@@ -331,34 +331,17 @@ substring to be sent. | |||
331 | </p> | 331 | </p> |
332 | 332 | ||
333 | <p class=return> | 333 | <p class=return> |
334 | If successful, the method returns the number of bytes sent. | 334 | If successful, the method returns the index of the last byte |
335 | In case of error, the method returns | 335 | within <tt>[i, j]</tt> that has been sent. Notice that, if |
336 | <b><tt>nil</tt></b>, followed by an error message, followed by the | 336 | <tt>i</tt> is 1 or absent, this is effectively the total |
337 | index of the first character within <tt>[i, j]</tt> that has not been sent yet | 337 | number of bytes sent. In case of error, the method returns |
338 | (you might want to try again from then on). The error message can be '<tt>closed</tt>' in case | 338 | <b><tt>nil</tt></b>, followed by an error message, followed |
339 | the connection was closed before the transmission was completed or the | 339 | by the index of the last byte within <tt>[i, j]</tt> that |
340 | string '<tt>timeout</tt>' in case there was a timeout during the | 340 | has been sent. You might want to try again from the byte |
341 | operation. | 341 | following that. The error message can be '<tt>closed</tt>' |
342 | </p> | 342 | in case the connection was closed before the transmission |
343 | 343 | was completed or the string '<tt>timeout</tt>' in case | |
344 | <p class=note> | 344 | there was a timeout during the operation. |
345 | <b>Important note</b>: | ||
346 | The return values for the <tt>send</tt> method have been changed in | ||
347 | LuaSocket 2.0 alpha <b>and again</b> in the beta (sorry)! | ||
348 | In previous versions, the method returned only the | ||
349 | error message. Since returning <b><tt>nil</tt></b> in case of success was | ||
350 | nonsense, in alpha the first return value became the number of bytes sent. | ||
351 | Alas, it wasn't returning <tt><b>nil</b></tt> in case of | ||
352 | error. So it was changed again in beta. | ||
353 | </p> | ||
354 | |||
355 | <p class=note> | ||
356 | <b>Also important</b>: | ||
357 | In order to better support non-blocking I/O and to discourage | ||
358 | bad practice, the <tt>send</tt> method now only sends one string | ||
359 | per call. The other optional arguments allow the user to select | ||
360 | a substring to be sent in a much more efficient way than | ||
361 | using <tt>string.sub</tt>. | ||
362 | </p> | 345 | </p> |
363 | 346 | ||
364 | <p class=note> | 347 | <p class=note> |