kaos.core.service.transport.flexfeed
Class FlexfeedCommServer

java.lang.Object
  extended by kaos.core.service.transport.flexfeed.FlexfeedCommServer
All Implemented Interfaces:
CommServer

public class FlexfeedCommServer
extends java.lang.Object
implements CommServer

CommServer is a simple Object passing class that sets up a simple server that can receive Objects. It can be initialized with or port or just find an open port


Nested Class Summary
 class FlexfeedCommServer.ClientHandler
           
 class FlexfeedCommServer.ServerThread
          Listens for new connections and add them to the list of connections to handle.
 
Field Summary
protected  java.util.Vector _clientHandlers
           
protected  java.lang.String _host
           
protected  TCPMessageReceiver _messageReceiver
           
protected  int _port
           
protected  ServerMocket _serverMocket
           
protected  java.util.Vector _vObjects
           
 
Constructor Summary
FlexfeedCommServer()
          testing constructor
FlexfeedCommServer(TCPMessageReceiver mr)
          Normal constructor
 
Method Summary
 void close()
          tries to close server socket
 java.lang.String getHost()
          returns the hostname of this server.
 java.lang.Object getNextObject()
          getNextObject
 java.util.Vector getNextObjects()
          Checks all incoming input streams for new objects.
 int getPort()
          returns the port number of this server.
 void init()
          Tries to start a socketserver on any available port.
 void init(int iPort)
          Tries to start a socketserver on the specified port.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_serverMocket

protected ServerMocket _serverMocket

_port

protected int _port

_host

protected java.lang.String _host

_clientHandlers

protected java.util.Vector _clientHandlers

_vObjects

protected java.util.Vector _vObjects

_messageReceiver

protected TCPMessageReceiver _messageReceiver
Constructor Detail

FlexfeedCommServer

public FlexfeedCommServer(TCPMessageReceiver mr)
Normal constructor


FlexfeedCommServer

public FlexfeedCommServer()
testing constructor

Method Detail

init

public void init()
          throws TransportFailure
Tries to start a socketserver on any available port.

Specified by:
init in interface CommServer
Throws:
TransportFailure

init

public void init(int iPort)
          throws TransportFailure
Tries to start a socketserver on the specified port.

Specified by:
init in interface CommServer
Parameters:
port -
Throws:
TransportFailure

close

public void close()
tries to close server socket

Specified by:
close in interface CommServer

getHost

public java.lang.String getHost()
returns the hostname of this server.

Specified by:
getHost in interface CommServer

getPort

public int getPort()
returns the port number of this server.

Specified by:
getPort in interface CommServer

getNextObject

public java.lang.Object getNextObject()
getNextObject

Returns:
object representing the next object

getNextObjects

public java.util.Vector getNextObjects()
Checks all incoming input streams for new objects. If there is an error checking the stream then the connection is closed. New objects read from each stream are added to the vector and returned.


main

public static void main(java.lang.String[] args)