diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2009-05-27 09:31:38 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2009-05-27 09:31:38 +0000 |
| commit | bce60be30fe8e9c1b0eb33128c23c93d7bca5303 (patch) | |
| tree | 3927343c777fcb7764a0f2f89754a0ceab141c21 /doc/socket.html | |
| parent | d1a72435d5bd3528f3c334cd4d1da16dcead47bf (diff) | |
| download | luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.tar.gz luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.tar.bz2 luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.zip | |
Decent makefiles!
Diffstat (limited to 'doc/socket.html')
| -rw-r--r-- | doc/socket.html | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/doc/socket.html b/doc/socket.html index f096e4b..490ab50 100644 --- a/doc/socket.html +++ b/doc/socket.html | |||
| @@ -24,8 +24,8 @@ | |||
| 24 | </td></tr> | 24 | </td></tr> |
| 25 | </table> | 25 | </table> |
| 26 | <p class=bar> | 26 | <p class=bar> |
| 27 | <a href="home.html">home</a> · | 27 | <a href="index.html">home</a> · |
| 28 | <a href="home.html#download">download</a> · | 28 | <a href="index.html#download">download</a> · |
| 29 | <a href="installation.html">installation</a> · | 29 | <a href="installation.html">installation</a> · |
| 30 | <a href="introduction.html">introduction</a> · | 30 | <a href="introduction.html">introduction</a> · |
| 31 | <a href="reference.html">reference</a> | 31 | <a href="reference.html">reference</a> |
| @@ -94,6 +94,24 @@ This constant is set to <tt><b>true</b></tt> if the library was compiled | |||
| 94 | with debug support. | 94 | with debug support. |
| 95 | </p> | 95 | </p> |
| 96 | 96 | ||
| 97 | <!-- get time +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 98 | |||
| 99 | <p class=name id=gettime> | ||
| 100 | socket.<b>gettime()</b> | ||
| 101 | </p> | ||
| 102 | |||
| 103 | <p class=description> | ||
| 104 | Returns the time in seconds, relative to the origin of the | ||
| 105 | universe. You should subtract the values returned by this function | ||
| 106 | to get meaningful values. | ||
| 107 | </p> | ||
| 108 | |||
| 109 | <pre class=example> | ||
| 110 | t = socket.gettime() | ||
| 111 | -- do stuff | ||
| 112 | print(socket.gettime() - t .. " seconds elapsed") | ||
| 113 | </pre> | ||
| 114 | |||
| 97 | <!-- newtry +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 115 | <!-- newtry +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| 98 | 116 | ||
| 99 | <p class=name id=newtry> | 117 | <p class=name id=newtry> |
| @@ -200,6 +218,15 @@ changed status. | |||
| 200 | </p> | 218 | </p> |
| 201 | 219 | ||
| 202 | <p class=note> | 220 | <p class=note> |
| 221 | <b>Note: </b>: <tt>select</tt> can monitor a limited number | ||
| 222 | of sockets, as defined by the constant <tt>socket._SETSIZE</tt>. This | ||
| 223 | number may be as high as 1024 or as low as 64 by default, | ||
| 224 | depending on the system. It is usually possible to change this | ||
| 225 | at compile time. Invoking <tt>select</tt> with a larger | ||
| 226 | number of sockets will raise an error. | ||
| 227 | </p> | ||
| 228 | |||
| 229 | <p class=note> | ||
| 203 | <b>Important note</b>: a known bug in WinSock causes <tt>select</tt> to fail | 230 | <b>Important note</b>: a known bug in WinSock causes <tt>select</tt> to fail |
| 204 | on non-blocking TCP sockets. The function may return a socket as | 231 | on non-blocking TCP sockets. The function may return a socket as |
| 205 | writable even though the socket is <em>not</em> ready for sending. | 232 | writable even though the socket is <em>not</em> ready for sending. |
| @@ -288,8 +315,8 @@ Freezes the program execution during a given amount of time. | |||
| 288 | </p> | 315 | </p> |
| 289 | 316 | ||
| 290 | <p class=parameters> | 317 | <p class=parameters> |
| 291 | <tt>Time</tt> is the number of seconds to sleep for. | 318 | <tt>Time</tt> is the number of seconds to sleep for. If |
| 292 | The function truncates <tt>time</tt> down to the nearest integer. | 319 | <tt>time</tt> is negative, the function returns immediately. |
| 293 | </p> | 320 | </p> |
| 294 | 321 | ||
| 295 | <!-- source +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 322 | <!-- source +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| @@ -324,24 +351,17 @@ side closes the connection. | |||
| 324 | The function returns a source with the appropriate behavior. | 351 | The function returns a source with the appropriate behavior. |
| 325 | </p> | 352 | </p> |
| 326 | 353 | ||
| 327 | <!-- time ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 354 | <!-- setsize ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| 328 | 355 | ||
| 329 | <p class=name id=gettime> | 356 | <p class=name id=setsize> |
| 330 | socket.<b>gettime()</b> | 357 | socket.<b>_SETSIZE</b> |
| 331 | </p> | 358 | </p> |
| 332 | 359 | ||
| 333 | <p class=description> | 360 | <p class=description> |
| 334 | Returns the time in seconds, relative to the origin of the | 361 | The maximum number of sockets that the <a |
| 335 | universe. You should subtract the values returned by this function | 362 | href=#select><tt>select</tt></a> function can handle. |
| 336 | to get meaningful values. | ||
| 337 | </p> | 363 | </p> |
| 338 | 364 | ||
| 339 | <pre class=example> | ||
| 340 | t = socket.gettime() | ||
| 341 | -- do stuff | ||
| 342 | print(socket.gettime() - t .. " seconds elapsed") | ||
| 343 | </pre> | ||
| 344 | |||
| 345 | <!-- try ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 365 | <!-- try ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| 346 | 366 | ||
| 347 | <p class=name id=try> | 367 | <p class=name id=try> |
| @@ -386,8 +406,8 @@ This constant has a string describing the current LuaSocket version. | |||
| 386 | <hr> | 406 | <hr> |
| 387 | <center> | 407 | <center> |
| 388 | <p class=bar> | 408 | <p class=bar> |
| 389 | <a href="home.html">home</a> · | 409 | <a href="index.html">home</a> · |
| 390 | <a href="home.html#down">download</a> · | 410 | <a href="index.html#down">download</a> · |
| 391 | <a href="installation.html">installation</a> · | 411 | <a href="installation.html">installation</a> · |
| 392 | <a href="introduction.html">introduction</a> · | 412 | <a href="introduction.html">introduction</a> · |
| 393 | <a href="reference.html">reference</a> | 413 | <a href="reference.html">reference</a> |
