From 96da86a81f0f37961851ead62404c255293eebdf Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Thu, 24 Nov 2005 20:29:28 +0000 Subject: [PATCH] Simplified documentation of send(). --- doc/tcp.html | 39 +++++++++++---------------------------- 1 file 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.

-If successful, the method returns the number of bytes sent. -In case of error, the method returns -nil, followed by an error message, followed by the -index of the first character within [i, j] that has not been sent yet -(you might want to try again from then on). The error message can be 'closed' in case -the connection was closed before the transmission was completed or the -string 'timeout' in case there was a timeout during the -operation. -

- -

-Important note: -The return values for the send method have been changed in -LuaSocket 2.0 alpha and again in the beta (sorry)! -In previous versions, the method returned only the -error message. Since returning nil in case of success was -nonsense, in alpha the first return value became the number of bytes sent. -Alas, it wasn't returning nil in case of -error. So it was changed again in beta. -

- -

-Also important: -In order to better support non-blocking I/O and to discourage -bad practice, the send method now only sends one string -per call. The other optional arguments allow the user to select -a substring to be sent in a much more efficient way than -using string.sub. +If successful, the method returns the index of the last byte +within [i, j] that has been sent. Notice that, if +i is 1 or absent, this is effectively the total +number of bytes sent. In case of error, the method returns +nil, followed by an error message, followed +by the index of the last byte within [i, j] that +has been sent. You might want to try again from the byte +following that. The error message can be 'closed' +in case the connection was closed before the transmission +was completed or the string 'timeout' in case +there was a timeout during the operation.