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 -> ?max_buffer_size:int -> ?buf_len: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 ] -> ('address, 'listening_on) Async.Tcp.Where_to_listen.t -> ('address -> Input_channel.t -> Output_channel.t -> unit Async.Deferred.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 listen_inet : ?max_connections:int -> ?max_accepts_per_batch:int -> ?backlog:int -> ?socket:([ `Unconnected ], Async.Socket.Address.Inet.t) Async.Socket.t -> ?max_buffer_size:int -> ?buf_len:int -> ?write_timeout:Core.Time_ns.Span.t -> ?time_source:[> Core.read ] Async.Time_source.T1.t -> on_handler_error: [ `Call of Async.Socket.Address.Inet.t -> exn -> unit | `Ignore | `Raise ] -> Async.Tcp.Where_to_listen.inet -> (Async.Socket.Address.Inet.t -> Input_channel.t -> Output_channel.t -> unit Async.Deferred.t) -> (Async.Socket.Address.Inet.t, int) Async.Tcp.Server.t
val with_connection : ?interrupt:unit Async.Deferred.t -> ?connect_timeout:Core.Time.Span.t -> ?max_buffer_size:int -> ?buf_len:int -> ?write_timeout:Core.Time_ns.Span.t -> ?time_source:[> Core.read ] Async.Time_source.T1.t -> [< Async.Socket.Address.t ] Async.Tcp.Where_to_connect.t -> (Input_channel.t -> Output_channel.t -> 'res Async.Deferred.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.

val connect : ?interrupt:unit Async.Deferred.t -> ?connect_timeout:Core.Time.Span.t -> ?max_buffer_size:int -> ?buf_len:int -> ?write_timeout:Core.Time_ns.Span.t -> ?time_source:[> Core.read ] Async.Time_source.T1.t -> [< Async.Socket.Address.t ] Async.Tcp.Where_to_connect.t -> (Input_channel.t * Output_channel.t) Async.Deferred.t