Network
Class Connection

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

public class Connection
extends java.lang.Thread


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
           
private  int id
           
private  java.io.BufferedReader in
           
private  java.io.BufferedWriter out
           
private  java.net.Socket socket
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Connection(GameField gameField, java.net.InetAddress address, int port)
          Constructeur utilisé par le client
Connection(GameField gameField, java.net.Socket socket)
          Constructeur utilisé par le serveur
 
Method Summary
 void close()
           
 GameField getGameField()
          Get the value of gameField
 int getid()
          Get the value of id
 java.io.BufferedReader getIn()
          Get the value of in
 java.io.BufferedWriter getOut()
          Get the value of out
 java.net.Socket getSocket()
          Get the value of socket
 void run()
          Ecoute sur le flux d'entrée et transfert les données au gameField (méthode receiveData() )
 void send(java.lang.String data)
          Envoie la chaine data sur le flux de sortie
 void setGameField(GameField value)
          Set the value of gameField
 void setid(int id)
          Set the value of id
 void setIn(java.io.BufferedReader value)
          Set the value of in
 void setOut(java.io.BufferedWriter value)
          Set the value of out
 void setSocket(java.net.Socket value)
          Set the value of socket
 
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

id

private int id

in

private java.io.BufferedReader in

out

private java.io.BufferedWriter out

socket

private java.net.Socket socket
Constructor Detail

Connection

public Connection(GameField gameField,
                  java.net.InetAddress address,
                  int port)
           throws java.io.IOException
Constructeur utilisé par le client

Parameters:
address - Adresse du serveur
port - Port d'écoute du serveur
Throws:
java.io.IOException - possible lors de l'ouverture des flux d'E/S

Connection

public Connection(GameField gameField,
                  java.net.Socket socket)
           throws java.io.IOException
Constructeur utilisé par le serveur

Parameters:
gameField -
socket - Socket de dialogue
Throws:
java.io.IOException - possible lors de l'ouverture des flux d'E/S
Method Detail

close

public void close()

getGameField

public GameField getGameField()
Get the value of gameField

Returns:
the value of gameField

getid

public int getid()
Get the value of id

Returns:
the value of id

getIn

public java.io.BufferedReader getIn()
Get the value of in

Returns:
the value of in

getOut

public java.io.BufferedWriter getOut()
Get the value of out

Returns:
the value of out

getSocket

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

Returns:
the value of socket

run

public void run()
Ecoute sur le flux d'entrée et transfert les données au gameField (méthode receiveData() )

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

send

public void send(java.lang.String data)
Envoie la chaine data sur le flux de sortie

Parameters:
data -

setGameField

public void setGameField(GameField value)
Set the value of gameField


setid

public void setid(int id)
Set the value of id


setIn

public void setIn(java.io.BufferedReader value)
Set the value of in


setOut

public void setOut(java.io.BufferedWriter value)
Set the value of out


setSocket

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