aboutsummaryrefslogtreecommitdiff
path: root/doc/tcp.html
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-07-18 22:56:14 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-07-18 22:56:14 +0000
commitc8b402e00442cd249397d4d33d2723a1f08a8108 (patch)
treed72a1ace55b42aa9d41c741fa2f757d92fad6592 /doc/tcp.html
parente4e2223cff658a7016724a625ebbd3dacb92a8f9 (diff)
downloadluasocket-c8b402e00442cd249397d4d33d2723a1f08a8108.tar.gz
luasocket-c8b402e00442cd249397d4d33d2723a1f08a8108.tar.bz2
luasocket-c8b402e00442cd249397d4d33d2723a1f08a8108.zip
Changed send function.
Diffstat (limited to 'doc/tcp.html')
-rw-r--r--doc/tcp.html35
1 files changed, 28 insertions, 7 deletions
diff --git a/doc/tcp.html b/doc/tcp.html
index 5f520e9..30e06f4 100644
--- a/doc/tcp.html
+++ b/doc/tcp.html
@@ -260,7 +260,7 @@ method returns <b><tt>nil</tt></b> followed by an error message.
260<!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 260<!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
261 261
262<p class=name id=receive> 262<p class=name id=receive>
263client:<b>receive(</b>[pattern]<b>)</b> 263client:<b>receive(</b>[pattern [, prefix]]<b>)</b>
264</p> 264</p>
265 265
266<p class=description> 266<p class=description>
@@ -283,6 +283,11 @@ the returned line. This is the default pattern;
283of bytes from the socket. 283of bytes from the socket.
284</ul> 284</ul>
285 285
286<p class=parameters>
287<tt>Prefix</tt> is an optional string to be concatenated to the beginning
288of any received data before return.
289</p>
290
286<p class=return> 291<p class=return>
287If successful, the method returns the received pattern. In case of error, 292If successful, the method returns the received pattern. In case of error,
288the method returns <tt><b>nil</b></tt> followed by an error message which 293the method returns <tt><b>nil</b></tt> followed by an error message which
@@ -305,18 +310,18 @@ too.
305<!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 310<!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
306 311
307<p class=name id=send> 312<p class=name id=send>
308client:<b>send(</b>string<sub>1</sub> [, 313client:<b>send(</b>data [, i [, j]]<b>)</b>
309string<sub>2</sub>, ... string<sub>N</sub>]<b>)</b>
310</p> 314</p>
311 315
312<p class=description> 316<p class=description>
313Sends data through client object. 317Sends <tt>data</tt> through client object.
314</p> 318</p>
315 319
316<p class=parameters> 320<p class=parameters>
317All parameters should be strings. For small strings, it is always better to 321<tt>Data</tt> is the string to be sent. The optional arguments
318concatenate them in Lua (with the '<tt>..</tt>' operator) and pass the 322<tt>i</tt> and <tt>j</tt> work exactly like the standard
319result to LuaSocket instead of passing several independent strings. 323<tt>string.sub</tt> Lua function to allow the selection of a
324substring to be sent.
320</p> 325</p>
321 326
322<p class=return> 327<p class=return>
@@ -341,6 +346,22 @@ Alas, it wasn't returning <tt><b>nil</b></tt> in case of
341error. So it was changed again in beta. 346error. So it was changed again in beta.
342</p> 347</p>
343 348
349<p class=note>
350<b>Also important</b>:
351In order to better support non-blocking I/O and to discourage
352bad practice, the <tt>send</tt> method now only sends one string
353per call. The other optional arguments allow the user to select
354a substring to be sent in a much more efficient way than
355using <tt>string.sub</tt>.
356</p>
357
358<p class=note>
359Note: Output is <em>not</em> buffered. For small strings,
360it is always better to concatenate them in Lua
361(with the '<tt>..</tt>' operator) and send the result in one call
362instead of calling the method several times.
363</p>
364
344<!-- setoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 365<!-- setoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
345 366
346<p class=name id=setoption> 367<p class=name id=setoption>