Class Protocols.Line.simple

Inheritance graph
Description

Simple nonblocking line-oriented I/O.


Constant line_separator

protected constant string Protocols.Line.simple.line_separator

Description

The sequence separating lines from eachother. "\r\n" by default.


Variable handle_data

function(string:void) Protocols.Line.simple.handle_data

Description

If this variable has been set, multiple lines will be accumulated, until a line with a single "." (period) is received. handle_data() will then be called with the accumulated data as the argument.

Note

handle_data() is one-shot, ie it will be cleared when it is called.

The line with the single "." (period) will not be in the accumulated data.

See also

handle_command()


Variable send_q

ADT.Queue Protocols.Line.simple.send_q

Description

Queue of data that is pending to send.

The elements in the queue are either strings with data to send, or 0 (zero) which is the end of file marker. The connection will be closed when the end of file marker is reached.

See also

send(), disconnect()


Method create

Protocols.Line.simple Protocols.Line.simple(Stdio.File con, int|void timeout)

Description

Create a simple nonblocking line-based protocol handler.

con is the connection.

timeout is an optional timeout in seconds after which the connection will be closed if there has been no data sent or received.

If timeout is 0 (zero), no timeout will be in effect.

See also

touch_time(), do_timeout()