package shuttle

  1. Overview
  2. Docs
val listen : ?max_connections:int -> ?max_accepts_per_batch:int -> ?backlog:int -> ?socket: ([ `Unconnected ], [< Async.Socket.Address.t ] as 'address) Async.Socket.t -> ?input_buffer_size:int -> ?max_input_buffer_size:int -> ?output_buffer_size:int -> ?max_output_buffer_size:int -> ?write_timeout:Core.Time_ns.Span.t -> ?time_source:[> Core.read ] Async.Time_source.T1.t -> on_handler_error:[ `Call of 'address -> exn -> unit | `Ignore | `Raise ] -> f:('address -> Input_channel.t -> Output_channel.t -> unit Async.Deferred.t) -> ('address, 'listening_on) Async.Tcp.Where_to_listen.t -> ('address, 'listening_on) Async.Tcp.Server.t Async.Deferred.t

listen is a wrapper for Async.Tcp.Server.create_sock. It uses async to setup a tcp server, and creates a new Input_channel and Output_channel to forward to the user provided tcp handler. listen will shutdown the server socket either if the handler raises an exception, or the Output_channel can no longer write any more bytes (it encountered an EPIPE, ECONNRESET). If the server loop is stopped because of a user exception, the exception will be re-raised once the socket has been shutdown.

val with_connection : ?interrupt:unit Async.Deferred.t -> ?timeout:Core.Time.Span.t -> ?input_buffer_size:int -> ?max_input_buffer_size:int -> ?output_buffer_size:int -> ?max_output_buffer_size:int -> ?time_source:[> Core.read ] Async.Time_source.T1.t -> f:(Input_channel.t -> Output_channel.t -> 'res Async.Deferred.t) -> [< Async.Socket.Address.t ] Async.Tcp.Where_to_connect.t -> 'res Async_kernel__Types.Deferred.t

with_connection is a wrapper for Async.Tcp.connect_sock. It uses async to setup a tcp client, and creates a new Input_channel and Output_channel to forward to the user provided handler.

OCaml

Innovation. Community. Security.