moonbridge

diff reference.txt @ 78:0ec070d6f5d9

Reverted experimental work on non-blocking I/O with file handles
author jbe
date Sun Apr 05 15:15:06 2015 +0200 (2015-04-05)
parents 38e7bd13200d
children 6b26783f9323
line diff
     1.1 --- a/reference.txt	Sun Apr 05 01:17:06 2015 +0200
     1.2 +++ b/reference.txt	Sun Apr 05 15:15:06 2015 +0200
     1.3 @@ -45,28 +45,6 @@
     1.4  
     1.5  
     1.6  
     1.7 -Function io.poll(read_fds, write_fds, timeout)
     1.8 -----------------------------------------------
     1.9 -
    1.10 -This function allows to wait for file descriptors to become ready for reading
    1.11 -or writing. It accepts the following arguments:
    1.12 -
    1.13 -1. Table of file descriptors to wait for reading (optional, may be nil)
    1.14 -2. Table of file descriptors to wait for writing (optional, may be nil)
    1.15 -3. Timeout in seconds (optional, may be nil or zero to disable timeout)
    1.16 -
    1.17 -Alternatively to file descriptors, the tables may contain file handles, in
    1.18 -which case the file descriptor is automatically extracted from the file handle
    1.19 -and, in case of waiting for reading, the file handle's buffer is additionally
    1.20 -tested for pending data.
    1.21 -
    1.22 -Please note that support for non-blocking I/O operations is limited if you use
    1.23 -ordinary file handles (as Moonbridge does). It is possible, however, to wait
    1.24 -until the first byte to read is available at a file handle. For more
    1.25 -information, see socket.input:pending().
    1.26 -
    1.27 -
    1.28 -
    1.29  Socket object passed to "connect" handler
    1.30  -----------------------------------------
    1.31  
    1.32 @@ -112,34 +90,6 @@
    1.33  Supports the same methods as io.open()'s return values.
    1.34  
    1.35  
    1.36 -### socket.input:xread(maxlen, terminator)
    1.37 -
    1.38 -Reads as many bytes until either the maximum length is reached (first argument)
    1.39 -or a terminating character (second argument as string with a length of 1) is
    1.40 -encountered. In the latter case, the terminating character will be included in
    1.41 -the result.
    1.42 -
    1.43 -On EOF, false (as first result value) and an error message (as second result
    1.44 -value) are returned. In case of an I/O error, nil and an error message are
    1.45 -returned.
    1.46 -
    1.47 -This method is also available for any other Lua file handle.
    1.48 -
    1.49 -
    1.50 -### socket.input:xread_nb(maxlen, terminator)
    1.51 -
    1.52 -Same as socket.input:xread(maxlen, terminator), but non-blocking. If no more
    1.53 -data can be read due to blocking, this method returns a string containing the
    1.54 -data which has already been read. If no data could be read due to blocking,
    1.55 -then an empty string is returned.
    1.56 -
    1.57 -On EOF, false (as first result value) and an error message (as second result
    1.58 -value) are returned. In case of an I/O error, nil and an error message are
    1.59 -returned.
    1.60 -
    1.61 -This method is also available for any other Lua file handle.
    1.62 -
    1.63 -
    1.64  ### socket.interval
    1.65  
    1.66  Set to the name of an interval timer if the "connect" handler was called due to
    1.67 @@ -174,40 +124,23 @@
    1.68  Supports the same methods as io.open()'s return values.
    1.69  
    1.70  
    1.71 -### socket.output:close()
    1.72 -
    1.73 -Performs a half-close (i.e. sends a TCP FIN package in case of a TCP socket).
    1.74 -
    1.75 -Note: In order to shut down a TCP connection properly, it may be necessary to
    1.76 -read any pending data from socket.input before closing the socket completely
    1.77 -(e.g. with socket:close() or by returning from the connect handler). If there
    1.78 -is still incoming data, a TCP RST packet might be sent which can cause loss of
    1.79 -transmitted data.
    1.80 -
    1.81 -
    1.82 -### socket.output:write_nb(...)
    1.83 -
    1.84 -Non-blocking write. This function attempts to write as many bytes as possible,
    1.85 -returning a string containing all data that could not be written due to
    1.86 -blocking (potentially concatenating some or all remaining arguments to create
    1.87 -that string).
    1.88 -
    1.89 -In case of an I/O error, nil (as first result value) and an error message (as
    1.90 -second result value) are returned.
    1.91 -
    1.92 -Note: Using this method will automatically flush any unflushed data written
    1.93 -through previous socket.output:write(...) calls. Thus, if any data was
    1.94 -previously written in a blocking fashion and has not been flushed, then the
    1.95 -socket.output:write_nb(...) call may block.
    1.96 -
    1.97 -This method is also available for any other Lua file handle.
    1.98 -
    1.99 -
   1.100  ### socket:read(...)
   1.101  
   1.102  Alias for socket.input:read()
   1.103  
   1.104  
   1.105 +### socket:readuntil(terminator, maxlen)
   1.106 +
   1.107 +Reads as many bytes until a byte equal to the terminator value occurs. An
   1.108 +optional maximum length may be specified. The terminating byte is included in
   1.109 +the return value (unless the maximum length would be exceeded). On EOF, nil is
   1.110 +returned. In case of an I/O error, nil (as first result value) plus an error
   1.111 +message (as second result value) is returned.
   1.112 +
   1.113 +This method is also available as :readuntil(...) for any other Lua file handle
   1.114 +(including socket.input).
   1.115 +
   1.116 +
   1.117  ### socket.remote_ip4
   1.118  
   1.119  Remote IPv4 address used for the connection. Encoded as 4 raw bytes in form of
   1.120 @@ -230,21 +163,6 @@
   1.121  Alias for socket.output:write(...)
   1.122  
   1.123  
   1.124 -### socket:write_nb(...)
   1.125 -
   1.126 -Alias for socket.output:write(...)
   1.127 -
   1.128 -
   1.129 -### socket:xread(maxlen, terminator)
   1.130 -
   1.131 -Alias for socket.input:xread(...)
   1.132 -
   1.133 -
   1.134 -### socket:xread_nb(maxlen, terminator)
   1.135 -
   1.136 -Alias for socket.input:xread_nb(...)
   1.137 -
   1.138 -
   1.139  
   1.140  HTTP module
   1.141  -----------

Impressum / About Us