package async

  1. Overview
  2. Docs
type transport_maker := Async_unix.Fd.t -> max_message_size:int -> Async_rpc_kernel.Rpc.Transport.t
val serve : where_to_listen:('address, 'listening_on) Async_unix.Tcp.Where_to_listen.t -> ?max_connections:int -> ?backlog:int -> ?drop_incoming_connections:bool -> ?time_source:[> Core.read ] Async_kernel.Time_source.T1.t -> ?max_message_size:int -> ?make_transport:transport_maker -> ?auth:('address -> bool) -> ?on_handler_error:[ `Raise | `Ignore | `Call of 'address -> exn -> unit ] -> (client_addr:'address -> server_addr:'address -> Async_rpc_kernel.Rpc.Transport.t -> unit Async_kernel.Deferred.t) -> ('address, 'listening_on) Async_unix.Tcp.Server.t Async_kernel.Deferred.t

serve takes a callback; your callback will be handed a Rpc.Transport.t and it's your responsibility to create the Rpc.Connection.t. The transport will be closed when your callback returns; ending your callback with a call to Rpc.Connection.close_finished is likely appropriate.

val serve_inet : where_to_listen: (Async_unix.Socket.Address.Inet.t, int) Async_unix.Tcp.Where_to_listen.t -> ?max_connections:int -> ?backlog:int -> ?drop_incoming_connections:bool -> ?time_source:[> Core.read ] Async_kernel.Time_source.T1.t -> ?max_message_size:int -> ?make_transport:transport_maker -> ?auth:(Async_unix.Socket.Address.Inet.t -> bool) -> ?on_handler_error: [ `Raise | `Ignore | `Call of Async_unix.Socket.Address.Inet.t -> exn -> unit ] -> (client_addr:Async_unix.Socket.Address.Inet.t -> server_addr:Async_unix.Socket.Address.Inet.t -> Async_rpc_kernel.Rpc.Transport.t -> unit Async_kernel.Deferred.t) -> (Async_unix.Socket.Address.Inet.t, int) Async_unix.Tcp.Server.t

serve_inet is like serve but only for inet sockets (not unix sockets), and returning the server immediately, without deferreds.

val connect : ?max_message_size:int -> ?make_transport:transport_maker -> ?tcp_connect_timeout:Core.Time_ns.Span.t -> 'addr Async_unix.Tcp.Where_to_connect.t -> (Async_rpc_kernel.Rpc.Transport.t * 'addr, Core.Exn.t) Core.Result.t Async_kernel.Deferred.t

connect ?make_transport where_to_connect () connects to the server at where_to_connect. On success, it returns the transport created using make_transport and the Socket.Address.t that it connected to, otherwise it returns the Error.

It is your responsibility to close the Transport.t

OCaml

Innovation. Community. Security.