nu.dll.fia
Class Server

java.lang.Object
  |
  +--nu.dll.fia.Server
All Implemented Interfaces:
java.util.Observer

public class Server
extends java.lang.Object
implements java.util.Observer

The Fia server. Can be started through the main() method or by an application through any of the constructors. A new thread will be started by the constructor, which will be waiting for new connections. When a connection is received, control will be delegated to a new thread responsible for reading and acting on behalf of that client.


Constructor Summary
Server()
           
Server(int port)
           
 
Method Summary
 void broadcast(nu.dll.fia.Game game, Message m)
           
 void broadcast(Message m)
           
 void broadcastExcept(nu.dll.fia.Server.Client c, nu.dll.fia.Game game, Message m)
           
 void broadcastExcept(nu.dll.fia.Server.Client client, Message m)
           
 void broadcastPlayers(nu.dll.fia.Game game, Message m)
           
 void broadcastPlayersExcept(nu.dll.fia.Server.Client c, nu.dll.fia.Game game, Message m)
           
 void clientDisconnected(nu.dll.fia.Server.Client c)
           
 void clientMessage(nu.dll.fia.Server.Client client, Message message)
           
static void main(java.lang.String[] argv)
           
 void newClient(java.net.Socket socket)
          Creates a new Client object and starts a thread to read from the socket.
 void start()
           
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Server

public Server()
       throws java.io.IOException

Server

public Server(int port)
       throws java.io.IOException
Method Detail

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Throwable

start

public void start()

newClient

public void newClient(java.net.Socket socket)
               throws java.io.IOException
Creates a new Client object and starts a thread to read from the socket.

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

clientDisconnected

public void clientDisconnected(nu.dll.fia.Server.Client c)
                        throws java.io.IOException

clientMessage

public void clientMessage(nu.dll.fia.Server.Client client,
                          Message message)
                   throws java.io.IOException

broadcastPlayers

public void broadcastPlayers(nu.dll.fia.Game game,
                             Message m)
                      throws java.io.IOException

broadcastPlayersExcept

public void broadcastPlayersExcept(nu.dll.fia.Server.Client c,
                                   nu.dll.fia.Game game,
                                   Message m)
                            throws java.io.IOException

broadcast

public void broadcast(nu.dll.fia.Game game,
                      Message m)
               throws java.io.IOException

broadcastExcept

public void broadcastExcept(nu.dll.fia.Server.Client c,
                            nu.dll.fia.Game game,
                            Message m)
                     throws java.io.IOException

broadcast

public void broadcast(Message m)
               throws java.io.IOException

broadcastExcept

public void broadcastExcept(nu.dll.fia.Server.Client client,
                            Message m)
                     throws java.io.IOException