Package com.sun.rpc
Class Rpc
java.lang.Object
com.sun.rpc.Rpc
This class transmits and receives RPC calls to an RPC service
at a specific host and port.
- Author:
- Brent Callaghan
- See Also:
-
Connection
RpcException
MsgAcceptedException
MsgDeniedException
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRpc
(Connection conn, int prog, int vers) Construct a new Rpc object - equivalent to a "client handle" using an AUTH_NONE cred handle.Rpc
(Connection conn, int prog, int vers, Cred cr) Construct a new Rpc object - equivalent to a "client handle" using a given cred handle "cr"Construct a new Rpc object - equivalent to a "client handle" -
Method Summary
Modifier and TypeMethodDescriptionvoid
delCred()
Delete the RPC credential data and destroy its security context with the server.getCred()
Return the RPC credentialgetPeer()
Since this returns the address of the server it may seem redundant - but if you receive a reply to a broadcast RPC you need to know who is replying.Make an RPC call but retry if necessary Retries use exponential backoff up to MAX_TIMEOUT ms.rpc_call_one
(Xdr call, byte[] arg, int timeout) Transmit the XDR call buffer containing an RPC header followed by a protocol header and receive the reply.void
rpc_header
(Xdr call, int proc) Construct an RPC header in the XDR buffervoid
Set the RPC credentialvoid
-
Field Details
-
conn
-
-
Constructor Details
-
Rpc
Construct a new Rpc object - equivalent to a "client handle" using an AUTH_NONE cred handle.- Parameters:
conn
- A connection to the serverprog
- The program number of the servicevers
- The version number of the service
-
Rpc
Construct a new Rpc object - equivalent to a "client handle" using a given cred handle "cr"- Parameters:
conn
- A connection to the serverprog
- The program number of the servicevers
- The version number of the servicecr
- The cred to be used: CredUnix or CredGss
-
Rpc
public Rpc(String server, int port, int prog, int vers, String proto, int maxReply) throws IOException Construct a new Rpc object - equivalent to a "client handle"- Parameters:
server
- The hostname of the serverport
- The port number for the serviceprog
- The program number of the servicevers
- The version number of the serviceproto
- The protocol to be used: "tcp" or "udp"maxReply
- The maximum size of the RPC reply- Throws:
IOException
- if an I/O error occurs
-
-
Method Details
-
setCred
Set the RPC credential- Parameters:
c
- - cred to be used- Throws:
RpcException
-
delCred
Delete the RPC credential data and destroy its security context with the server.- Throws:
RpcException
-
getCred
Return the RPC credential- Returns:
- The credential
-
setRpcHandler
-
rpc_header
Construct an RPC header in the XDR buffer- Parameters:
call
- The XDR buffer for the headerproc
- The service procedure to be called- Throws:
RpcException
-
rpc_call_one
Transmit the XDR call buffer containing an RPC header followed by a protocol header and receive the reply.- Parameters:
call
- XDR buffer containing RPC call to transmitarg
- (seq_num + RPC argument) if wraptimeout
- after this number of milliseconds- Returns:
- Xdr the XDR buffer for the reply
- Throws:
RpcException
IOException
-
rpc_call
Make an RPC call but retry if necessary Retries use exponential backoff up to MAX_TIMEOUT ms. Note that we handle TCP connections differently: there is no timeout, and retransmission is used only when reconnecting.- Parameters:
call
- XDR buffer containing RPC call to transmittimeout
- for the initial callretries
- the number of times to retry the call. A value of zero implies forever.- Returns:
- Xdr the XDR buffer for the reply
- Throws:
IOException
-
getPeer
Since this returns the address of the server it may seem redundant - but if you receive a reply to a broadcast RPC you need to know who is replying.- Returns:
- address of the Peer
-