All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class distinct.rpc.JRPCClient

java.lang.Object
   |
   +----distinct.rpc.JRPCClient

public class JRPCClient
extends Object
implements Serializable
From this class all Jrpcgen generated interfaces are derived. Basically it is a wrapper around a protocol object (derived from ClientGeneric). This can be either a ClientTCP or a ClientUDP object for a standard RPC protocol connection or a ClientHTTP object for an HTTP-tunneling connection.

See Also:
ClientGeneric

Constructor Index

 o JRPCClient(ClientGeneric)
Creates a RPC client and initializes it with a protocol client.
 o JRPCClient(InetAddress, int, int, boolean)
Creates a RPC client and connects it to a server.
 o JRPCClient(InetAddress, int, int, int, boolean)
Creates a RPC client and connects it to a server with a known port.

Method Index

 o BroadcastCall(int, int, int, XDRType, XDRType, BroadcastHandler)
Calls all available servers by sending a broadcast message.
 o Call(int, XDRType, XDRType)
Calls the server.
 o CloseClient()
Closes the RPC client and frees the resources.
 o GetClient()
Returns the protocol client.
 o SetClient(ClientGeneric)
Sets the protocol client.
 o SetTimeout(int)
Changes the timeout value for waiting on server replies.

Constructors

 o JRPCClient
 public JRPCClient(InetAddress host,
                   int prog,
                   int vers,
                   boolean stream) throws RPCError
Creates a RPC client and connects it to a server. Calls the remote Portmapper in order to get the port of the server.

Parameters:
host - The host on which the server lives.
prog - The program ID of the server as defined in the .x IDL file.
vers - The program version of the server as defined in the .x IDL file.
stream - true for a TCP connection, false for UDP.
Throws: RPCError
When the connection could not be established.
 o JRPCClient
 public JRPCClient(InetAddress host,
                   int prog,
                   int vers,
                   int port,
                   boolean stream) throws RPCError
Creates a RPC client and connects it to a server with a known port. (No interaction with a portmapper)

Parameters:
host - The host on which the server lives.
prog - The program ID of the server as defined in the .x IDL file.
vers - The program version of the server as defined in the .x IDL file.
port - The port on which the server listens.
stream - true for a TCP connection, false for UDP.
Throws: RPCError
When the connection could not be established.
 o JRPCClient
 public JRPCClient(ClientGeneric protocol)
Creates a RPC client and initializes it with a protocol client.

Parameters:
protocol - The protocol object that implements the client connection.

Methods

 o Call
 public void Call(int proc,
                  XDRType in,
                  XDRType out) throws RPCError, IOException
Calls the server.

Parameters:
proc - The ID of the requested function.
in - The input parameter (as it has to be marshalled it must be derived from XDRType).
out - The output parameter (as it has to be marshalled it must be derived from XDRType).
Throws: IOException
When the call fails because the socket connetion fails.
Throws: RPCError
When the calls fails for any other reason.
 o BroadcastCall
 public static void BroadcastCall(int prog,
                                  int vers,
                                  int proc,
                                  XDRType in,
                                  XDRType out,
                                  BroadcastHandler eachcall) throws RPCError, IOException
Calls all available servers by sending a broadcast message. Calls are made indirectly via the portmapper's "CALLIT" interface. Only UDP calls are supported.

Parameters:
prog - The program ID of the server as defined in the .x IDL file.
vers - The program version of the server as defined in the .x IDL file.
proc - The ID of the request function as defined in the .x IDL file.
in - The input parameter (as it has to be marshalled it must be derived from XDRType).
out - The output parameter (as it has to be marshalled it must be derived from XDRType).
eachcall - The handler for all reply messages (null if the call should not wait for any reply).
Throws: IOException
When the call fails because the socket connetion fails.
Throws: RPCError
When the calls fails for any other reason.
 o GetClient
 public ClientGeneric GetClient()
Returns the protocol client.

Returns:
The protocol object.
 o SetClient
 public void SetClient(ClientGeneric protocol)
Sets the protocol client.

Parameters:
protocol - The protocol object that implements the client connection.
 o CloseClient
 public void CloseClient()
Closes the RPC client and frees the resources.

 o SetTimeout
 public void SetTimeout(int timeout)
Changes the timeout value for waiting on server replies.

Parameters:
timeout - The new timeout value in ms (0 means no timeout at all, -1 means immediate return).

All Packages  Class Hierarchy  This Package  Previous  Next  Index