Plasma GitLab Archive
Projects Blog Knowledge

Class type Uq_transfer.async_in_channel

class type async_in_channel = object .. end

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.


Methods from raw_in_channel

method input : Stdlib.Bytes.t -> int -> int -> int

input s k n: Reads channel data into the substring of s 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.

The exception 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 : int

Returns the number of characters read from the channel

Additional control methods

method can_input : bool

Whether input is possible, i.e. the input method gets at least one byte, or can signal End_of_file.

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.

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml