All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class distinct.rpc.ClientTCP

java.lang.Object
   |
   +----distinct.rpc.ClientGeneric
           |
           +----distinct.rpc.ClientTCP

public class ClientTCP
extends ClientGeneric
Implementation of the RPC protocol via TCP.

See Also:
ClientGeneric

Constructor Index

 o ClientTCP(InetAddress, int, int)
Creates a new TCP protocol object.
 o ClientTCP(InetAddress, int, int, int)
Creates a new TCP protocol object and connects it to a server with a known port.

Method Index

 o Call(int, int, int, XDRType, XDRType)
Calls the server.
 o close()
Closes the connection and frees the socket resource.
 o setTimeout(int)
Changes the timeout value for waiting on server replies (default is 25s).

Constructors

 o ClientTCP
 public ClientTCP(InetAddress host,
                  int prog,
                  int vers,
                  int port) throws IOException
Creates a new TCP protocol object 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.
Throws: IOException
When the socket could not be opened.
 o ClientTCP
 public ClientTCP(InetAddress host,
                  int prog,
                  int vers) throws RPCError, IOException
Creates a new TCP protocol object. Calls the portmapper to get the port information.

Parameters:
host - The host on which the server lives. In an applet this must be the host where the applet comes from.
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.
Throws: RPCError
When the port can not be found in the portmapper (perhaps there is even no portmapper running).
Throws: IOException
When the socket could not be opened.

Methods

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

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).
Throws: IOException
When the call fails because the socket connetion fails.
Throws: RPCError
When the calls fails for any other reason.
Overrides:
Call in class ClientGeneric
 o close
 public void close()
Closes the connection and frees the socket resource.

Overrides:
close in class ClientGeneric
 o setTimeout
 public void setTimeout(int timeout)
Changes the timeout value for waiting on server replies (default is 25s).

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

All Packages  Class Hierarchy  This Package  Previous  Next  Index