jAER project on SourceForge

net.sf.jaer.eventio
Class AEServerSocket

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.jaer.eventio.AEServerSocket
All Implemented Interfaces:
java.lang.Runnable

public class AEServerSocket
extends java.lang.Thread

Following is target functionality (right now this class only opens a single socket to most recent client connecting to it and events are only streamed to this one socket): This server socket allows a source host to listen for connections from other hosts and open AESockets to them to allow streaming AE data to them, so as a server, we stream events to the clients. These stream socket connections transmit data reliably.

Multile clients can recieve events from a single server through the use of java.nio channels and selectors.

The AESocket's are manufactured when a client connects to the AEViewer. The AESocket's are built with options that are set using the AEServerSocketOptionsDialog. This AEServerSocket is a Thread and it must be started after construction to allow incoming connections.

AEServerSocket has PropertyChangeSupport; see the getSupport() method for change event information.

Author:
tobi

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int DEFAULT_BUFFERED_STREAM_SIZE_BYTES
           
static int DEFAULT_RECIEVE_BUFFER_SIZE_BYTES
           
static int DEFAULT_SEND_BUFFER_SIZE_BYTES
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AEServerSocket()
          Creates a new instance of AEServerSocket.
 
Method Summary
 void close()
          shuts down the server socket thread and closes the server socket
 AESocket getAESocket()
           
 int getBufferedStreamSize()
           
 int getPort()
           
 int getReceiveBufferSize()
           
 int getSendBufferSize()
           
 java.beans.PropertyChangeSupport getSupport()
          PropertyChange events are fired as follows: "clientconnected" - when a client has connected to us.
 boolean isFlushPackets()
           
 boolean isUseBufferedStreams()
           
static void main(java.lang.String[] a)
          Tests class by constructing a socket and starting the thread
 void run()
          Accepts incoming connections and manufactures AESocket's for them.
 void setBufferedStreamSize(int bufferedStreamSize)
           
 void setFlushPackets(boolean flushPackets)
           
 void setPort(int port)
           
 void setReceiveBufferSize(int receiveBufferSize)
           
 void setSendBufferSize(int sendBufferSize)
           
 void setSocket(AESocket socket)
           
 void setUseBufferedStreams(boolean useBufferedStreams)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BUFFERED_STREAM_SIZE_BYTES

public static final int DEFAULT_BUFFERED_STREAM_SIZE_BYTES
See Also:
Constant Field Values

DEFAULT_SEND_BUFFER_SIZE_BYTES

public static final int DEFAULT_SEND_BUFFER_SIZE_BYTES
See Also:
Constant Field Values

DEFAULT_RECIEVE_BUFFER_SIZE_BYTES

public static final int DEFAULT_RECIEVE_BUFFER_SIZE_BYTES
See Also:
Constant Field Values
Constructor Detail

AEServerSocket

public AEServerSocket()
               throws java.io.IOException
Creates a new instance of AEServerSocket. This Thread must be started to serve connections.

Throws:
java.net.BindException - when the socket is already bound (probably by another viewer)
java.io.IOException
Method Detail

toString

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

run

public void run()
Accepts incoming connections and manufactures AESocket's for them. Currently only a single client is supported.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getAESocket

public AESocket getAESocket()

setSocket

public void setSocket(AESocket socket)

main

public static void main(java.lang.String[] a)
Tests class by constructing a socket and starting the thread


setBufferedStreamSize

public void setBufferedStreamSize(int bufferedStreamSize)

setSendBufferSize

public void setSendBufferSize(int sendBufferSize)

setPort

public void setPort(int port)

getSendBufferSize

public int getSendBufferSize()

getBufferedStreamSize

public int getBufferedStreamSize()

getReceiveBufferSize

public int getReceiveBufferSize()

setReceiveBufferSize

public void setReceiveBufferSize(int receiveBufferSize)

getPort

public int getPort()

isFlushPackets

public boolean isFlushPackets()

setFlushPackets

public void setFlushPackets(boolean flushPackets)

close

public void close()
           throws java.io.IOException
shuts down the server socket thread and closes the server socket

Throws:
java.io.IOException

isUseBufferedStreams

public boolean isUseBufferedStreams()
Returns:
the useBufferedStreams

setUseBufferedStreams

public void setUseBufferedStreams(boolean useBufferedStreams)
Parameters:
useBufferedStreams - the useBufferedStreams to set

getSupport

public java.beans.PropertyChangeSupport getSupport()
PropertyChange events are fired as follows:

Returns:
the support.

jAER project on SourceForge