Module RPCClient

module RPCClient: sig .. end

This provides a lightweight RPC mechanism on top of a network implementation and B-encoded messages.
type address = NetTcp.Address.t 
type 'a result = 
| NoReply
| Reply of 'a
| Error of string
module Result: sig .. end
type t 


val connection : t -> NetTcp.Connection.t
Underlying connection
val address : t -> address
Remote address
val is_alive : t -> bool
Is the proxy alive?
val close : t -> unit
Close the connection and make the proxy unusable.
val call : ?timeout:float ->
t -> string -> Bencode.t -> Bencode.t result Lwt.t
Call a remote method, with given name and arguments, and get a future reply
timeout : number of seconds without answer before we decide that no answer will come. After this delay, the result will be Error. By default, 20 seconds.
val call_ignore : t -> string -> Bencode.t -> unit
Call a remote method, without expecting result. Errors will not be reported.

Typed method invocation

module Typed: sig .. end

Creation of proxy

A proxy is parametrized by a period. This period, measured in seconds, is the amount of time between two successive checks of query expiration. Every period seconds, the system removes method calls that have timeouted, and close them (by sending Error)
val of_conn : ?period:float -> NetTcp.Connection.t -> t
Create a proxy from an existing connection
Returns a proxy that acts as a "remote" object on which methods can be called, or None in case of failure
val connect : ?period:float -> address -> t option Lwt.t
Connect to a remote node by address.
val by_host : ?period:float -> string -> int -> t option Lwt.t
val local : ?period:float -> int -> t option Lwt.t
val by_name : ?period:float -> string -> int -> t option Lwt.t
DNS lookup before connecting
val fmt : Format.formatter -> t -> unit