Ocamlnet 3 Reference Manual : Uq_engines.output_async_mplex

# Class Uq_engines.output_async_mplex

    class output_async_mplex : ?onclose:[ `Ignore | `Write_eof ] -> ?onshutdown:onshutdown_out_spec -> ?buffer_size:int -> multiplex_controller -> async_out_channel_engine

Creates an asynchronous output channel writing to the multiplex controller (see also `output_async_descr` for the corresponding class writing to a single descriptor).

`onclose`: What to do when the `close_out` method is invoked. Defaults to ``Ignore`. ``Write_eof` means to write the EOF marker. Anyway, after doing the close action, the multiplex controller is shutdown.

`onshutdown`: What to do when all data (and optionally, the EOF marker) have been written. It is also invoked in case of I/O errors. The default is ``Ignore`. The value ``Initiate_shutdown` means that it is started to shutdown the socket. The success of this action is not waited upon, however. One can also pass ``Action f` in which case the function `f` is called with this object, the multiplex controller, and the proposed next state as arguments. By checking the proposed next state the function can see why the shutdown function was called.

`buffer_size`: The size of the internal buffer. By default unlimited.

Note that the engine is done when the output channel is closed. The socket is not shut down, and the underlying file descriptor is not closed! You can define the `shutdown` callback to do something in this case.