net.sf.magicproject.network
Class MSocketListener

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.magicproject.network.MSocketListener
All Implemented Interfaces:
java.lang.Runnable

public final class MSocketListener
extends java.lang.Thread

This class is listening to the actions done by the opponent and apply the corresponding actions. These actions may be : click on cards, ability choosen, mana use and auto-options changment.

Since:
0.4
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
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 void closeConnections()
          Close connections.
static MSocketListener getInstance()
          Return the unique instance of this class.
static void init()
          Create a new instance of this class.
 void newMessage(java.io.InputStream in)
          To read anew message
 int readReplacementAnswer()
          Read and return replacement answer.
 void run()
          run this thread
 
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
 

Method Detail

init

public static void init()
Create a new instance of this class.


getInstance

public static MSocketListener getInstance()
Return the unique instance of this class.

Returns:
the unique instance of this class.

newMessage

public void newMessage(java.io.InputStream in)
                throws java.io.IOException
To read anew message

Parameters:
in - the input stram
Throws:
java.io.IOException

run

public void run()
run this thread

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

closeConnections

public void closeConnections()
Close connections.


readReplacementAnswer

public int readReplacementAnswer()
Read and return replacement answer.

Returns:
the replacement answer.


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