com.superhac.JXBStreamer.Core
Class XBMSPServer

java.lang.Object
  extended by com.superhac.JXBStreamer.Core.XBMSPServer
All Implemented Interfaces:
java.lang.Runnable

public class XBMSPServer
extends java.lang.Object
implements java.lang.Runnable

This is the main class that is used for running a XBMSP server. The server uses non-blocking socket IO and runs as a thread.

More information can be found at Superhac.com


Constructor Summary
XBMSPServer()
          Creates an instance of the XBMSP Server that runs as a thread.
 
Method Summary
protected  int getMaximumClientIdleTime()
          Gets the maximum client idle time before being disconnected by the server.
 int getPort()
          Gets the binding port for the XBMSP server.
protected  java.util.ArrayList<XBMSPServerMessageHandler> getServerMessageHandlers()
          Returns an ArrayList of the message handlers.
 ServerStatus getServerStatus()
          Provides detailed information about each connected client.
 boolean isAutoDiscoveryEnabled()
          Is the the XBMSP server configured for the AutoDiscovery Service(UDP)? Clients can broadcast on port 1400 and the server will respond with identifying information that can be used to connect to the server.
 boolean isServerRunning()
          Is the server running.
 void run()
          Main loop of the Server running as a Thread.
 void setAutoDiscoveryEnabled(boolean autoDiscoveryEnabled)
          Clients can broadcast on port 1400 and the server will respond with identifying information that can be used to connect to the server.
protected  void setMaximumClientIdleTime(int maximumClientIdleTime)
          Sets the maximum client idle time before being disconnected by the server.
 void setPort(int port)
          Set the port number the server will listen on.
 void setVirtualRoot(java.util.ArrayList<java.io.File> virtualRoot)
          Set the virtual root directory.
 void startServer()
          Starts the server so it can recieve incoming connections.
 void stopServer()
          Stops the server from accepting connections and also disconnects any connected clients.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XBMSPServer

public XBMSPServer()
Creates an instance of the XBMSP Server that runs as a thread. The instance threads itself and does not stop running as a thread until the virtual machine is terminated.

Method Detail

run

public void run()
Main loop of the Server running as a Thread. Comes from impementing Runnable

Specified by:
run in interface java.lang.Runnable

getServerStatus

public ServerStatus getServerStatus()
Provides detailed information about each connected client.

Returns:
The server status object which contains info about each connected client.

isServerRunning

public boolean isServerRunning()
Is the server running. E.g. Listening for incoming connections.

Returns:
True if the server is awaiting comming connections and false if not.

stopServer

public void stopServer()
Stops the server from accepting connections and also disconnects any connected clients.


startServer

public void startServer()
Starts the server so it can recieve incoming connections.


getPort

public int getPort()
Gets the binding port for the XBMSP server.

Returns:
The port number the server is listening on.

setPort

public void setPort(int port)
Set the port number the server will listen on.

Parameters:
port - The port number the server will bind to.

isAutoDiscoveryEnabled

public boolean isAutoDiscoveryEnabled()
Is the the XBMSP server configured for the AutoDiscovery Service(UDP)? Clients can broadcast on port 1400 and the server will respond with identifying information that can be used to connect to the server.

Returns:
True if the Discovery Server is running and False if not.

setAutoDiscoveryEnabled

public void setAutoDiscoveryEnabled(boolean autoDiscoveryEnabled)
Clients can broadcast on port 1400 and the server will respond with identifying information that can be used to connect to the server.

Parameters:
autoDiscoveryEnabled - True if it should be enabled and false if not.

setVirtualRoot

public void setVirtualRoot(java.util.ArrayList<java.io.File> virtualRoot)
Set the virtual root directory. This allows multiple directories to be shared that are spread over different paths. The client is presented with a virtual root directory that consists of the supplied paths as a single dirctory.

Parameters:
virtualRoot - An arraylist of files that make up the virtual root directory

getServerMessageHandlers

protected java.util.ArrayList<XBMSPServerMessageHandler> getServerMessageHandlers()
Returns an ArrayList of the message handlers. The message handlers handle the communicate between the client and the server. Each connected client has its own message handler. As a packet comes into the server it is routed to the appropraite message handler for that client.

Returns:
The current message handlers for the clients

getMaximumClientIdleTime

protected int getMaximumClientIdleTime()
Gets the maximum client idle time before being disconnected by the server.

Returns:
The currently set Idle time in seconds.

setMaximumClientIdleTime

protected void setMaximumClientIdleTime(int maximumClientIdleTime)
Sets the maximum client idle time before being disconnected by the server.

Parameters:
maximumClientIdleTime - The maximum amount of idle time before the server disconnects the client.