Ocamlnet 4 Reference Manual : Nethttpd_kernel.lingering_close

# Class Nethttpd_kernel.lingering_close

    class lingering_close : ?preclose:unit -> unit -> Unix.file_descr -> object .. end

Closes a file descriptor using the "lingering close" algorithm. The optional `preclose` function is called just before `Unix.close`.

## Closes a file descriptor using the "lingering close" algorithm

Usage:

     while lc # lingering do lc # cycle ~block:true () done

    method cycle : ?block:bool -> unit -> unit

Reads data from the file descriptor until EOF or until a fixed timeout is over. Finally, the descriptor is closed. If `block` is set, the method blocks until data is available. (Default: `false`)

    method lingering : bool

Whether the socket is still lingering

    method fd : Unix.file_descr

The file descriptor