keepalive.apps
Class Server

java.lang.Object
  |
  +--keepalive.apps.App
        |
        +--keepalive.apps.Server
All Implemented Interfaces:
java.lang.Runnable

public class Server
extends keepalive.apps.App
implements java.lang.Runnable

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


Constructor Summary
Server()
          Run the 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 server application.
 void listen()
          Listen for incoming socket connections.
static void main(java.lang.String[] args)
          Run the Server application with real TCP/IP sockets.
 void run()
          Listen for connections.
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

Server

public Server()
Run the application.
Method Detail

createUI

protected KeepAliveUI createUI()
Create the user interface.
Overrides:
createUI in class keepalive.apps.App
Following copied from class: keepalive.apps.App
Returns:
A new User Interface.

run

public void run()
Listen for connections.
Specified by:
run in interface java.lang.Runnable

listen

public void listen()
Listen for incoming socket connections.

toString

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

isServerSide

protected boolean isServerSide()
Indicates that this application is a server application. Abstract in superclass.
Overrides:
isServerSide in class keepalive.apps.App
Following copied from class: keepalive.apps.App
Returns:
True iff this is a server-side app.

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Run the Server 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 in binding the ServerSocket.

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