Plasma GitLab Archive
Projects Blog Knowledge

Class type Uq_transfer.async_out_channel

class type async_out_channel = object .. end

An asynchrounous output channel provides methods to output data to a stream descriptor. It is based on raw_out_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 space in the output buffer. Furthermore, one can request notification in the case that there is no space or again space in the output buffer.


Methods from raw_out_channel

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

output s k n: Writes the substring of s beginning at index k with length n into the channel. The channel is free to accept only a portion of the string (or even nothing), and returns the number of bytes it accepts.

method close_out : unit -> unit

Closes the channel

method pos_out : int

Returns the number of characters output into the channel

method flush : unit -> unit

Flushes the channel. Asynchronous channels usually ignore flush requests. A potential meaning of flushing could be that no more data are accepted until the current buffer is completely processed. Implementing this is optional.

Additional control methods

method can_output : bool

Whether output is possible, i.e. the output method accepts at least one byte

method request_notification : (unit -> bool) -> unit

After the notification has been requested, the passed function is be called whenever can_output 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