|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.distinct.rpc.JRPCServer
All JRPC servers are derived from this abstract class. It declares the methods for initializing a server and for registering it at the portmapper.
| Constructor Summary | |
JRPCServer(int prog,
int vers,
boolean do_portmap)
Creates a RPC server and starts a portmapper thread if requested. |
|
| Method Summary | |
Auth |
DoAuth(int proc,
Auth cred,
Auth verf)
Overwrite this method only if you want your server to check authentication (by default there is no check). |
boolean |
DoCall(int proc,
XDRStream xin,
XDRStream xout)
Dispatch routine which interprets the call requests of a server. |
boolean |
DoVersionCheck(int vers)
Overwrite this method only if you want your server to check compatibility of program versions in a user-defined way (by default it simply checks whether it is the same version as given in the constructor). |
java.net.Socket[] |
EnumerateConnections()
Returns an array with the sockets of the currently active TCP clients. |
java.net.InetAddress |
getAddress()
Determines the host address of the sender of the currently processed RPC request. |
int |
getCallVersion()
Determines the version number of the currently processed RPC request. |
java.lang.Object |
getClientData()
Gets client-specific data for this server thread. |
int |
GetConnectionState()
Returns the number of currently active TCP clients. |
int |
getPort()
Determines the port number of the sender of the currently processed RPC request. |
int |
getVersion()
Returns the version number of the server object. |
boolean |
IsBatched(int proc)
Overwrite this method only if you want to implement batched RPCs. |
boolean |
isMultithreaded()
Determines whether the server can serve multiple requests concurrently. |
boolean |
isTCPServer()
Determines whether the current thread serves a TCP or a UDP request. |
boolean |
RegisterServer(int port,
boolean stream)
Registers the RPC server in the local portmapper. |
boolean |
RegisterServer(int vers,
int port,
boolean stream)
Registers the RPC server in the local portmapper. |
void |
run()
The TCP server thread. |
void |
setClientData(java.lang.Object data)
Sets client-specific data for this server thread. |
void |
setMultithreaded(boolean s,
int udpservers)
Selects whether the server can serve multiple requests concurrently. |
void |
setStreamed(boolean s)
Switches between the different TCP server implementations. |
int |
StartTCP(int port)
Starts the TPC server and its thread. |
int |
StartTCP(java.net.ServerSocket sock)
Starts the TPC server and its thread. |
int |
StartUDP(java.net.DatagramSocket sock)
Starts the UDP server and its thread. |
int |
StartUDP(int port)
Starts the UDP server and its thread. |
void |
Stop(boolean stop_portmap)
Stops the server. |
boolean |
UnregisterServer()
Unregisters the RPC server in the local portmapper. |
boolean |
UnregisterServer(int vers)
Unregisters the RPC server in the local portmapper. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JRPCServer(int prog,
int vers,
boolean do_portmap)
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.do_portmap - If true, it tries to start a portmapper.| Method Detail |
public boolean DoCall(int proc,
XDRStream xin,
XDRStream xout)
proc - The index of the requested function.xin - Read the input parameter from this XDR stream.xout - Write the return parameter to this XDR stream.
public boolean DoVersionCheck(int vers)
vers - The version of the server as requested by the incoming call.
public Auth DoAuth(int proc,
Auth cred,
Auth verf)
throws RPCError
proc - The ID of the requested function.cred - Authentication parameter provided by the client.verf - Verifier parameter provided by the client.
RPCError - If the authentication fails.public int getVersion()
public boolean RegisterServer(int vers,
int port,
boolean stream)
vers - A version number of the program of the server.port - The port on which the server waits for requests.stream - true for a TCP server, false for UDP.
public boolean RegisterServer(int port,
boolean stream)
port - The port on which the server waits for requests.stream - true for a TCP server, false for UDP.
public final void run()
run in interface java.lang.Runnable
public int StartTCP(int port)
throws RPCError
port - The port on which the server waits for requests. If 0 an arbitrary port is chosen.
RPCError - If the server could not be started.
public int StartTCP(java.net.ServerSocket sock)
throws RPCError
sock - The socket on which the server waits for requests.
RPCError - If the server could not be started.
public int StartUDP(int port)
throws RPCError
port - The port on which the server should wait for requests. If 0 an arbitrary port is chosen.
RPCError - If the server could not be started.
public int StartUDP(java.net.DatagramSocket sock)
throws RPCError
sock - The socket on which the server waits for requests.
RPCError - If the server could not be started.public void Stop(boolean stop_portmap)
stop_portmap - If "true" a RPC Portmapper that was started by this server is stoped as well.public boolean UnregisterServer(int vers)
vers - A version number of the program of the server.
public boolean UnregisterServer()
public boolean IsBatched(int proc)
proc - The ID of the executed function.
public void setClientData(java.lang.Object data)
data - Any Java object.public java.lang.Object getClientData()
public boolean isTCPServer()
public java.net.InetAddress getAddress()
public int getPort()
public int getCallVersion()
public void setStreamed(boolean s)
s - true: use XDRRecordSreams (no buffering, recommended for huge data only).
false: use internal buffering (default)
public void setMultithreaded(boolean s,
int udpservers)
s - true: use multithreading.
false: do not use multithreading (default)udpservers - Minimum number of concurrently active server threads for UDP requests (default: 1).public boolean isMultithreaded()
public java.net.Socket[] EnumerateConnections()
public int GetConnectionState()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||