Module Udp.Config

module Config: sig .. end
A typical receive loop calls before before calling its callback to prepare a packet buffer for reading and after afterwards to prepare for writing (for the next iteration).

One can specify ~before:ignore or ~after:ignore to disable the default action, as when doing buffer management in the callback. One can also specify an action, such as ~after:Iobuf.compact for use with read_loop on a connection-oriented socket or file. It's often convenient to use the same interface for UDP, TCP, and file variants of the same protocol.

stop terminates a typical loop as soon as possible, when it becomes determined.


type t = {
   capacity : int;
   init : Udp.write_buffer;
   before : Udp.write_buffer -> unit;
   after : Udp.write_buffer -> unit;
   stop : unit Import.Deferred.t;
}
val stop : t -> unit Import.Deferred.t
val after : t -> Udp.write_buffer -> unit
val before : t -> Udp.write_buffer -> unit
val init : t -> Udp.write_buffer
val capacity : t -> int
module Fields: sig .. end
val create : ?capacity:int ->
?init:Udp.write_buffer ->
?before:(Udp.write_buffer -> unit) ->
?after:(Udp.write_buffer -> unit) ->
?stop:unit Import.Deferred.t -> unit -> t