netbula.ORPC

Class ClientTCP


public class ClientTCP
extends InetRPCClient

RPC client using the TCP protocol.

Field Summary

Fields inherited from class netbula.ORPC.RPCClient

IPPROTO_TCP, IPPROTO_UDP

Constructor Summary

ClientTCP(InetAddress inetAddress, int prog, int ver)
ClientTCP(InetAddress inetAddress, int prog, int ver, int port)
ClientTCP(Socket connected_socket, int prog, int ver)
Create a TCP client from a connected Socket
ClientTCP(String host, int prog, int ver)
Create a TCP client
ClientTCP(String hostname, int prog, int ver, int port)

Method Summary

void
call(int proc, XDT inarg, XDT outarg)
boolean
close()
Close the connection to the server
boolean
connect()
Connect to the RPC server
Socket
getSocket()
Return the TCP Socket associated with the RPC client.
boolean
tcpCallResultReady()
void
tcp_async_call(int proc, XDT inarg)
Initiate an asynchronous call which returns immediately.
void
tcp_async_get_result(int proc, XDT outarg)
Obtain the results from an asynchronous call

Methods inherited from class netbula.ORPC.InetRPCClient

close, connect, getserver_port, setServer

Methods inherited from class netbula.ORPC.RPCClient

call, call_proc0, close, connect, finalize, getAuth, getRpcProgramNumber, getRpcProtocol, getRpcVersionNumber, setAuth, setConnectionTimeout, setRpcProgramNumber, setRpcProtocol, setRpcVersionNumber, setServer, setTimeout

Constructor Details

ClientTCP

public ClientTCP(InetAddress inetAddress,
                 int prog,
                 int ver)
            throws rpc_err

ClientTCP

public ClientTCP(InetAddress inetAddress,
                 int prog,
                 int ver,
                 int port)
            throws rpc_err

ClientTCP

public ClientTCP(Socket connected_socket,
                 int prog,
                 int ver)
            throws rpc_err
Create a TCP client from a connected Socket
Parameters:
connected_socket - A connected socket
prog - Program number
ver - Version numbr

ClientTCP

public ClientTCP(String host,
                 int prog,
                 int ver)
            throws rpc_err
Create a TCP client
Parameters:
host - Server host name
prog - RPC program number
ver - Version numbr

ClientTCP

public ClientTCP(String hostname,
                 int prog,
                 int ver,
                 int port)
            throws rpc_err

Method Details

call

public void call(int proc,
                 XDT inarg,
                 XDT outarg)
            throws rpc_err
Overrides:
call in interface RPCClient

close

public boolean close()
Close the connection to the server
Overrides:
close in interface InetRPCClient

connect

public boolean connect()
            throws rpc_err
Connect to the RPC server
Overrides:
connect in interface InetRPCClient

getSocket

public Socket getSocket()
Return the TCP Socket associated with the RPC client. One could then set socket options on it.

tcpCallResultReady

public boolean tcpCallResultReady()
            throws rpc_err
Returns:
true if the call is ready with result

tcp_async_call

public void tcp_async_call(int proc,
                           XDT inarg)
            throws rpc_err
Initiate an asynchronous call which returns immediately. The caller can then use the tcpCallResultReady() method to check if the call has returned. The tcp_async_get_result(int proc, XDT outarg) method is then used to get the result. There can be only one call pending at any time on one client handle.
Parameters:
proc - procedure number
inarg - input parameter

tcp_async_get_result

public void tcp_async_get_result(int proc,
                                 XDT outarg)
            throws rpc_err
Obtain the results from an asynchronous call
Parameters:
proc - procedure number
outarg - output parameter