cam.netapp.NetworkConnection
The "back-end" does not require an instance of this class (it is only required to implement the Runnable interface and the SetStreams interface).
The remote class usually resides on another machine, but for development purposes, one can use a NetworkConnection to connect to a class on a local machine.
In order to establish a remote class instance on another machine, an instance of the ServerManager class must be executing on that machine.
Chris Anderson, Dan Delsol © UCLA 1997
NetworkConnection() |
Constructor. |
void connectRemoteApplication(String eAdd, int portNum, String appName) throws NetAppException |
The remote application class appName is instantiated on a remote machine with ethernet address eAdd and listening
on port number portNum. This port number is the particular value associated with a ServerManager instance running
on the remote machine. (It is set by the person who initiates the ServerManager). The default port number is 6789. Stream communication is established with the remote class. This routine throws a NetAppExceptiont, so it must be encapsulated in a try/catch block. The NetAppException message provides information about the error that occurred. |
void connectRemoteApplication(String eAdd, int portNum, String appName,int auxConnections)
throws NetAppException |
Creates a connection to the application appName at (address,port) with auxConnections auxillary socket connections. Typically auxConnections = 1 for use in creating NetworkConnection callbacks from the application to the client. |
void connectRemoteApplication(String appName) throws NetAppException |
The remote application class appName is instantiated on the local machine. Stream communication is established
with the remote class. This routine throws a NetAppException object, so it must be encapsulated in a try/catch block. The Exception thrown provides information about the error that occurred. |
void startRemoteApplication() |
A thread on the remote machine is created for the remote application. This thread is started (i.e. the remote application's run() method is invoked). |
void stopRemoteApplication() |
The remote application thread is stopped. |
void pauseRemoteApplication() |
The remote application thread is paused. |
void resumeRemoteApplication() |
The remote application thread is resumed. |
String getRemoteApplicationStatus() |
Returns the running status of the remote application. |
void disconnectRemoteApplication() |
The remote application and its' control are stopped. |
Application Socket/Stream Access
InputStream getInputStream() |
Returns the inputStream connected to the remote application. |
OutputStream getOutputStream() |
Returns the outputStream connected to the remote application. |
Socket getSocket() |
Returns the socket connected to the remote application. (If the remote class is on the local machine, this function returns null). |
Socket getAuxSocket(int k) |
Returns the kth auxillary socket connected to the remote application. |
InputStream getControlInputStream() |
Returns the inputStream connected to the remote application control. |
OutputStream getControlOutputStream() |
Returns the outputStream connected to the remote application control. |
Socket getControlSocket() |
Returns the socket connected to the remote application control. (If the remote class is on the local machine, this function returns null). |
public void setVerboseFlag(boolean v) |
Sets the internal verbose flag to the value v. If this flag is true, then diagnostics are written to System.out. |
protected void finalize() |
The remote application and its' control are stopped. |