class type async_in_channel =
An asynchrounous input channel provides methods to input data from
a stream descriptor. It is based on
raw_in_channel, which is
defined by the Ocamlnet module
Netchannels (see there for an
introduction into the idea of using objects as I/O channels).
An asynchronous channel can indicate that there is no data in the
input buffer. Furthermore, one can request notification in the case
that there is no data or again data in the input buffer.
method input :
Stdlib.Bytes.t -> int -> int -> int
input s k n: Reads channel data into the substring of
beginning at index
k with length
n. The channel is free to
fill only a portion of the string (or even nothing). The method
returns the number of bytes actually read.
End_of_file indicates that the end of the channel
is reached. The return value
0, however, means that no data
could be read.
method close_in :
unit -> unit
Closes the channel
method pos_in :
Returns the number of characters read from the channel
method can_input :
Whether input is possible, i.e. the input method gets at least
one byte, or can signal
method request_notification :
(unit -> bool) -> unit
After the notification has been requested, the passed function is
be called whenever
can_input changes its value (or might change
its value). The function returns
true if there is still interest
in notification, and
false if notification must be disabled.
There can be any number of parallel active notifications. It is allowed that a notification callback requests further notifications.