net.sf.magicproject.network
Class Server

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.magicproject.network.NetworkActor
          extended by net.sf.magicproject.network.Server
All Implemented Interfaces:
java.lang.Runnable, IdMessages

public class Server
extends NetworkActor
implements IdMessages

a multi-client server

Since:
0.2c
Author:
Fabrice Daugan

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 java.net.ServerSocket serverSocket
          the server's socket of this connexion
 
Fields inherited from class net.sf.magicproject.network.NetworkActor
cancelling
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface net.sf.magicproject.network.IdMessages
BEGIN_GAME_DATA, BEGIN_MESSAGE_DATA, CLICK_MANA, COLOR_ANSWER, END_GAME_DATA, END_MESSAGE_DATA, INTEGER_ANSWER, MAX_PLAYERS, MOVE_ORDER_ANSWER, MSG_ANSWER, MSG_CHOICE, MSG_CLICK_ABILITY, MSG_CLICK_ACTION, MSG_CLICK_CARD, MSG_CLICK_MANA, MSG_CLICK_PLAYER, MSG_CLICK_TRIGGERED_CARD, MSG_DISCONNECT, MSG_SKIP, PROPERTY_ANSWER, REPLACEMENT_ANSWER, STR_DISCONNECT, STR_DONE, STR_NEED_ACK, STR_NOPASSWD, STR_OK, STR_PASSWD, STR_WRONGPASSWD, STR_WRONGVERSION, TIME_OUT, TRIGGERED_CARD_CHOICE, ZONE_ANSWER
 
Constructor Summary
Server(Deck deck, char[] passwd)
          create a new server for a specified port, play name, nickName and password required (null if none)
 
Method Summary
 void closeConnexion()
          end this server, close all connexions with connected clients
 void run()
          If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns.
 
Methods inherited from class net.sf.magicproject.network.NetworkActor
cancelConnexion, flush, send
 
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, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serverSocket

public java.net.ServerSocket serverSocket
the server's socket of this connexion

Constructor Detail

Server

public Server(Deck deck,
              char[] passwd)
create a new server for a specified port, play name, nickName and password required (null if none)

Parameters:
deck - the deck of this server
passwd - is the password needed to connect to this play
Method Detail

run

public void run()
If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns.

Subclasses of Thread should override this method.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.start(), Thread.Thread(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String), Runnable.run()

closeConnexion

public void closeConnexion()
Description copied from class: NetworkActor
end this server, close all connexions with connected clients

Overrides:
closeConnexion in class NetworkActor


Copyright © 2003-2007 Magic-Project. All Rights Reserved.