Network
Class WaitConnection

java.lang.Object
  extended by java.lang.Thread
      extended by Network.WaitConnection
All Implemented Interfaces:
java.lang.Runnable

public class WaitConnection
extends java.lang.Thread

Class WaitConnection


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  GameField gameField
           
static int MAX_CLIENT
           
private  int nbClient
           
private  int nbClientConnected
           
private  Network network
           
private  java.net.ServerSocket socket
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
WaitConnection(GameField gameField, Network network, int port, int nbClient)
           
 
Method Summary
 Network getNetwork()
          Get the value of network
 java.net.ServerSocket getSocket()
          Get the value of socket
 void lostConnexion()
          Décrémente le nb de client connecté relance l'attente si besoin
 void run()
          Attend les connections des clients et les ajoutent dans Network.connections
 void setNetwork(Network value)
          Set the value of network
 void setSocket(java.net.ServerSocket value)
          Set the value of socket
 void stopWait()
          Stoppe l'écoute
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gameField

private GameField gameField

MAX_CLIENT

public static final int MAX_CLIENT
See Also:
Constant Field Values

nbClient

private int nbClient

nbClientConnected

private int nbClientConnected

network

private Network network

socket

private java.net.ServerSocket socket
Constructor Detail

WaitConnection

public WaitConnection(GameField gameField,
                      Network network,
                      int port,
                      int nbClient)
               throws java.io.IOException,
                      NetworkException
Throws:
java.io.IOException
NetworkException
Method Detail

getNetwork

public Network getNetwork()
Get the value of network

Returns:
the value of network

getSocket

public java.net.ServerSocket getSocket()
Get the value of socket

Returns:
the value of socket

lostConnexion

public void lostConnexion()
Décrémente le nb de client connecté relance l'attente si besoin


run

public void run()
Attend les connections des clients et les ajoutent dans Network.connections

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

setNetwork

public void setNetwork(Network value)
Set the value of network


setSocket

public void setSocket(java.net.ServerSocket value)
Set the value of socket


stopWait

public void stopWait()
Stoppe l'écoute