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
-
JRPCClient(ClientGeneric)
- Creates a RPC client and initializes it with a protocol client.
-
JRPCClient(InetAddress, int, int, boolean)
- Creates a RPC client and connects it to a server.
-
JRPCClient(InetAddress, int, int, int, boolean)
- Creates a RPC client and connects it to a server with a known port.
-
BroadcastCall(int, int, int, XDRType, XDRType, BroadcastHandler)
- Calls all available servers by sending a broadcast message.
-
Call(int, XDRType, XDRType)
- Calls the server.
-
CloseClient()
- Closes the RPC client and frees the resources.
-
GetClient()
- Returns the protocol client.
-
SetClient(ClientGeneric)
- Sets the protocol client.
-
SetTimeout(int)
- Changes the timeout value for waiting on server replies.
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.
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.
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.
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.
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.
GetClient
public ClientGeneric GetClient()
- Returns the protocol client.
- Returns:
- The protocol object.
SetClient
public void SetClient(ClientGeneric protocol)
- Sets the protocol client.
- Parameters:
- protocol - The protocol object that implements the client connection.
CloseClient
public void CloseClient()
- Closes the RPC client and frees the resources.
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