(Unix.file_descr -> 'a) -> Unix.file_descr -> float -> Unixqueue.event_system ->
Generic input engine for reading from a file descriptor:
let e = new input_engine f fd tmo - Waits until the file descriptor
becomes readable, and calls then
let x = f fd to read from the
descriptor. The result
x is the result of the engine.
If the file descriptor does not become readable within
the resulting engine transitions to
Use this class to construct engines reading via
comparable I/O functions:
let read_engine fd tmo esys = new input_engine (fun fd -> let buf = String.create 4096 in let n = Unix.read fd buf 0 (String.length buf) in String.sub buf 0 n ) fd tmo esys
This engine returns the read data as string.
Uq_io.input_e for a more generic way of reading with