com.monoserv
Class MonoServ

java.lang.Object
  extended by com.monoserv.MonoServ

public class MonoServ
extends java.lang.Object

A single instance of the MonoServ software. This will handle and facailitate all the threads for a single "server" running on a single port. Lots of things are hard-coded at the moment, and will be changed in the near future.


Constructor Summary
MonoServ(java.lang.String xmlFile)
          Constructor with a XML file as the starting point for the server.
 
Method Summary
 void Init()
          Initializes the server settings and enables the "server_active" field.
 void ServerCleanup()
          Just closes the ServerSocket at the moment.
 void ServerLoop()
          The main server loop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonoServ

public MonoServ(java.lang.String xmlFile)
Constructor with a XML file as the starting point for the server. Also calls Init() to setup variables.

Parameters:
xmlFile - A string representation of the XML config file to load.
See Also:
Init()
Method Detail

Init

public void Init()
          throws java.lang.Exception
Initializes the server settings and enables the "server_active" field.

Throws:
java.lang.Exception - If something bad goes wrong during setup.

ServerLoop

public void ServerLoop()
                throws java.lang.RuntimeException,
                       java.io.IOException
The main server loop. This is a blocking function that runs an infinite loop based on "server_active" field or until an Exception is thrown. Inside the loop is the ServerSocket.accept() call which waits for a connection. Other messages are printed to the STDERR. This will be changed to eventually throw exceptions instead of just printing message. It currently also prints messages before and after the while loop indicating starting and stopping of the server. Will eventually be passed through a logging mechanisms.

Throws:
java.lang.RuntimeException - If the server has not been properly initialized
java.io.IOException - If something goes wrong in the network communication.

ServerCleanup

public void ServerCleanup()
                   throws java.io.IOException
Just closes the ServerSocket at the moment.

Throws:
java.io.IOException - Based on the close() method in ServerSocket
See Also:
ServerSocket.close()