keepalive.apps
Class Client

java.lang.Object
  |
  +--keepalive.apps.App
        |
        +--keepalive.apps.Client

public class Client
extends keepalive.apps.App

A Client application. Can run with simulated sockets or real TCP/IP sockets.


Constructor Summary
Client(java.lang.String serverName)
          Start the client application.
 
Method Summary
protected  void connect(AbstractSocket sock)
          Using the socket, create Input and Output objects, hook the Input and Output objects into their UIs, start the Keep-Alive, and then wait for the Input/Output to finish (i.e.
protected  KeepAliveUI createUI()
          Create the user interface
 KeepAliveUI getKeepAliveUI()
          Accessor method.
 Receiver getReceiver()
          Accessor method.
 Sender getSender()
          Accessor method.
protected  boolean isServerSide()
          Indicates that this application is a client application.
static void main(java.lang.String[] args)
          Run the Client application with real TCP/IP sockets.
 void openConnectionToServer()
          Connect to the server.
protected  void setKeepAliveUI(KeepAliveUI keepAliveUI)
          Mutator method.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Client

public Client(java.lang.String serverName)
Start the client application.
Parameters:
serverName - Name of server host to which we will connect.
Method Detail

createUI

protected KeepAliveUI createUI()
Create the user interface
Overrides:
createUI in class keepalive.apps.App
Returns:
the user interface.

openConnectionToServer

public void openConnectionToServer()
Connect to the server.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isServerSide

protected boolean isServerSide()
Indicates that this application is a client application. Abstract in superclass.
Overrides:
isServerSide in class keepalive.apps.App
Returns:
false to indicate that this is a client application.

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Run the Client application with real TCP/IP sockets.
Parameters:
args - command line arguments; use -help to get usage description.
Throws:
java.io.IOException - if an I/O error occurs.

connect

protected void connect(AbstractSocket sock)
Using the socket, create Input and Output objects, hook the Input and Output objects into their UIs, start the Keep-Alive, and then wait for the Input/Output to finish (i.e. for the application to finish).
Parameters:
sock - Socket with which we connect to the other side.

getSender

public Sender getSender()
Accessor method.
Returns:
The Sender through which this object sends messages. May return null.

getReceiver

public Receiver getReceiver()
Accessor method.
Returns:
The Receiver through which this object receives messages. May be null.

setKeepAliveUI

protected void setKeepAliveUI(KeepAliveUI keepAliveUI)
Mutator method.
Parameters:
keepAliveUI - the user interface associated with this application.

getKeepAliveUI

public KeepAliveUI getKeepAliveUI()
Accessor method.
Returns:
the user interface associated with this application.


© 2000 Joshua Fox