package capnp-rpc-unix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Helpers for using Capnp_rpc_lwt on traditional operating systems.

module Listen_address : sig ... end
module Connect_address : sig ... end
val endpoint_of_socket : switch:Lwt_switch.t -> Lwt_unix.file_descr -> Capnp_rpc_lwt.Endpoint.t

endpoint_of_socket ~switch fd is an endpoint that sends and receives on fd. When switch is turned off, fd is closed.

val serve : ?backlog:int -> ?offer:'a Capnp_rpc_lwt.Capability.t -> Listen_address.t -> 'b Lwt.t

serve ~offer address listens for new connections on address and handles them. Clients can get access to the bootstrap object offer. backlog is passed to Unix.listen.

val connect : ?switch:Lwt_switch.t -> ?offer:'a Capnp_rpc_lwt.Capability.t -> Connect_address.t -> 'b Capnp_rpc_lwt.Capability.t

connect addr connects to the server at addr and returns its bootstrap object. If offer is given, the client will also offer this service to the remote vat. If switch is given then turning it off will disconnect, and disconnecting will turn off the switch.

OCaml

Innovation. Community. Security.