Go to the first, previous, next, last section, table of contents.


The Bufrw module

type fill_buffer_type = string -> int -> int

the type of functions to fill buffers. my_fill_buffer buf size takes a buffer buf of size size and returns the number of bytes copied in the buffer. Such a function should return 0 when there is no more data available.

type read_buffer_type = string -> unit

the type of functions to read buffers

val fill_buffer_from_string : string -> fill_buffer_type

to fill a buffer from a string

val fill_buffer_from_file_descr : in_channel -> fill_buffer_type

to fill a buffer from the contents of a file

val buf_write : float -> Unix.file_descr -> fill_buffer_type -> unit

buf_write timeout fd my_fill_buffer writes the data provided by my_fill_buffer on the file descriptor fd. raise Timeout.Timeout if writing one buffer takes longer than timeout seconds.

val buf_read : float -> Unix.file_descr -> read_buffer_type -> unit

buf_read timeout fd my_read_buffer reads data from a file descriptor fd until no more data is available, applying my_read_buffer to each buffered read. raise Timeout.Timeout if reading one buffer takes longer than timeout seconds.


Go to the first, previous, next, last section, table of contents.