|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
common.StoppableThread
common.TransfertSlave
common.TCPHandler
public class TCPHandler
Gère une connexion TCP avec un hôte distant et permet de fermer correctement la connexion avec celui-ci.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected BufferedReader |
inputStream
Flux en entrée de la connexion. |
private PrintWriter |
outputStream
Flux en sortie de la connexion. |
private Socket |
tcpSocket
Socket de connexion TCP. |
protected static int |
TIME_WAITING_TRANSFERT_CLOSING
|
| Fields inherited from class common.TransfertSlave |
|---|
master |
| Fields inherited from class common.StoppableThread |
|---|
quitQuery |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
protected |
TCPHandler(TransfertMaster master,
Socket tcpSocket)
Prépare la connexion TCP en initialisant les flux E/S. |
protected |
TCPHandler(TransfertMaster master,
String host,
int port)
Prépare la connexion TCP en initialisant les flux E/S. |
| Method Summary | |
|---|---|
protected void |
doFree()
Libère les ressources utilisées et ferme le socket TCP. |
void |
quit()
Ferme le thread ainsi que la connexion TCP. |
void |
sendCommand(RemoteCommand command)
Envoit une commande par le flux TCP. |
void |
sendCommand(RemoteCommand command,
String argument)
Envoit une commande et son argument par le flux TCP. |
| Methods inherited from class common.StoppableThread |
|---|
doQuit, free |
| 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, run, 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 |
|---|
protected static final int TIME_WAITING_TRANSFERT_CLOSING
private final Socket tcpSocket
protected final BufferedReader inputStream
private final PrintWriter outputStream
| Constructor Detail |
|---|
protected TCPHandler(TransfertMaster master,
Socket tcpSocket)
throws SocketStartFailure
master - le transfert parenttcpSocket - le socket de connexion à manipluer
SocketStartFailure - s'il est impossible d'ouvrir les flux E/S.
protected TCPHandler(TransfertMaster master,
String host,
int port)
throws SocketStartFailure
master - le transfert parenthost - l'hôte sur lequel se connecterport - le port de connexion
SocketStartFailure - en cas de problème d'ouverture du socket, de connexion au
serveur ou s'il est impossible d'ouvrir les flux E/S.| Method Detail |
|---|
public final void sendCommand(RemoteCommand command,
String argument)
command - la commande à envoyer.argument - l'argument (si applicable).public final void sendCommand(RemoteCommand command)
command - la commande à envoyer.public final void quit()
quit in class StoppableThreadThread.join(),
StoppableThread.free(),
StoppableThread.doQuit()protected final void doFree()
doFree in class StoppableThreadTIME_WAITING_TRANSFERT_CLOSING
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||