module Rpc_simple_client:Synchronous API for RPC clientssig
..end
type
t
val create : Rpc_client.connector -> Rpc.protocol -> Rpc_program.t -> t
val call : t -> string -> Xdr.xdr_value -> Xdr.xdr_value
call simple_client procedure_name procedure_arg
:
Call the procedure with the given name and the given argument. Returns
the result of the procedure on success; otherwise raises an exception.
Note that it is possible that the connection is aborted and the
client is reset. In this case call
raises an exception but it is
currently difficult to recognize this case.
Other reasons may be that the server refuses the call (e.g. because
of missing authentication).
Frequent exceptions:
Rpc.Rpc_server condition
: The server did not like the call;
the 'condition' explains whyRpc.Rpc_cannot_unpack reason
: Got a badly formatted message.Rpc_client.Message_lost
: The stream ended before there was any
reply (perhaps not even the call could
be sent over the stream)Rpc_client.Message_timeout
: There was no reply for the specified
period of timeRpc_client.Communication_error x
:
An I/O error or a serious internal
error happened
Failure s
: Mostly: The internal state of the client
does not allow to do another callRpc_server
exception has clear semantics as it is
known that the procedure has not been invoked.
It is a good choice to shut down the connection if one of the other
exceptions happens. (Note that the connection may already have been
shutted down, but it is ok to shut down twice.)val shut_down : t -> unit