class type multiplex_controller =Aobject
..end
multiplex_controller
is a quite low-level device to abstract
bidirectional socket connections. It is independent of any real
device.
There can be a reader, a writer (or both), or alternatively,
the shutdown process may be in progress. One cannot have more than
one reader and more than more writer.
method alive : bool
method event_system : Unixqueue.event_system
method reading : bool
method start_reading : ?peek:(unit -> unit) ->
when_done:(exn option -> int -> unit) -> string -> int -> int -> unit
when_done
callback is invoked. The int is the number of read
bytes. It is 0 if an error occurred which is indicated by the
exception. The exception End_of_file
is used when the end of the
data stream is reached. The exception Cancelled
indicates that
reading has been cancelled in the meantime.
This starts one-time read job only, i.e. it is not restarted
after when_done
has been invoked.
It is an error to start reading several times.
The function peek
is called immediately before data is read in
from the underlying communication channel.
method cancel_reading : unit -> unit
when_done
callback is invoked with the
number of bytes read so far (which may be 0) and the exception
Cancelled
.
It is no error if there is no reader.
method writing : bool
method start_writing : when_done:(exn option -> int -> unit) -> string -> int -> int -> unit
when_done
callback is invoked. The int is the number of written
bytes. It is 0 if an error occurred which is indicated by the
exception. The exception Cancelled
indicates that
writing has been cancelled in the meantime.
This starts one-time write job only, i.e. it is not restarted
after when_done
has been invoked.
It is an error to start writing several times.
method supports_half_open_connection : bool
method start_writing_eof : when_done:(exn option -> unit) -> unit -> unit
when_done
callback is invoked. The exception Cancelled
indicates
that writing has been cancelled in the meantime.
This starts one-time write job only, i.e. it is not restarted
after when_done
has been invoked.
It is an error to start writing several times. It is an error to
write EOF when the socket does not support half-open connections.
method cancel_writing : unit -> unit
when_done
callback is invoked with the
number of bytes read so far (which may be 0) and the exception
Canelled
.
It is no error if there is no writer.
method read_eof : bool
method wrote_eof : bool
method shutting_down : bool
method start_shutting_down : ?linger:float -> when_done:(exn option -> unit) -> unit -> unit
when_done
callback is invoked. The exception
indicates whether an error happened. Cancelled
means that the
shutdown operation has been cancelled in the meantime.
The underlying file descriptor (if any) is not closed. A shutdown
is only a protocol handshake. After a shutdown, both read_eof
and wrote_eof
are true. Call inactivate
to close the descriptor.
Optionally, one can linger
for a certain period of time.
It is only lingered when the EOF was written before the EOF
is seen on input.
Defaults to linger 60.0
. Set to 0 to turn off.
method cancel_shutting_down : unit -> unit
when_done
callback is invoked with
the exception Cancelled
.
It is no error if no shutdown is in progress.
method inactivate : unit -> unit