oogp2p.network
Class BaseServer

java.lang.Object
  extended byjava.lang.Thread
      extended byoogp2p.network.BaseServer
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
Server

public abstract class BaseServer
extends java.lang.Thread


Field Summary
(package private)  java.awt.List connection_list
           
protected  java.util.Vector connections
           
static int DEFAULT_PORT
           
protected  java.net.ServerSocket listen_socket
           
protected  int port
           
protected  java.lang.ThreadGroup threadgroup
           
protected  Vulture vulture
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BaseServer()
           
BaseServer(int port)
           
 
Method Summary
 void BroadcastToAll(java.lang.Object o)
          Broadcast object to all connections
 void CreateDisplay(java.awt.List connection_list)
           
 void CreateSocket(int port)
          Create socket given port
static void fail(java.lang.Exception e, java.lang.String msg)
           
 void InitializeContainers()
          Initialize containers for the class
 void listenForSocket()
          Listens for the sockets to connect and creates Conenction threads for them.
protected  void notifyConnections()
          Notify all connections that they should start communicating.
abstract  void run()
          This function is started when this.start() is executed.
 void waitForConnections()
          Can be implemented to have the server wait for connections, and then use notifyConnections() to start.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

listen_socket

protected java.net.ServerSocket listen_socket

connection_list

java.awt.List connection_list

threadgroup

protected java.lang.ThreadGroup threadgroup

connections

protected java.util.Vector connections

vulture

protected Vulture vulture

port

protected int port
Constructor Detail

BaseServer

public BaseServer()

BaseServer

public BaseServer(int port)
Method Detail

fail

public static void fail(java.lang.Exception e,
                        java.lang.String msg)

CreateDisplay

public void CreateDisplay(java.awt.List connection_list)

notifyConnections

protected void notifyConnections()
Notify all connections that they should start communicating.


BroadcastToAll

public void BroadcastToAll(java.lang.Object o)
Broadcast object to all connections


CreateSocket

public void CreateSocket(int port)
Create socket given port


InitializeContainers

public void InitializeContainers()
Initialize containers for the class


listenForSocket

public void listenForSocket()
Listens for the sockets to connect and creates Conenction threads for them.


run

public abstract void run()
This function is started when this.start() is executed. Can be used to always wait for connections.


waitForConnections

public void waitForConnections()
Can be implemented to have the server wait for connections, and then use notifyConnections() to start.