fungus.core.infrastructure
Class NetConnection

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--fungus.core.infrastructure.NetConnection
All Implemented Interfaces:
Runnable

public class NetConnection
extends Thread

Connection réseaux.
supporte un socket et suis le protocole

Since:
1.0
Version:
$Header: /cvsroot/fungus-agent/fungus/src/fungus/core/infrastructure/NetConnection.java,v 1.36 2003/04/30 16:59:14 djedi Exp $
Author:
"Valvassori Moïse"
See Also:
Thread

Field Summary
static String eom
          End of message
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NetConnection(Socket s, NetworkService n, Infrastructure i)
          Créer une nouvelle connection entrante.
NetConnection(Socket s, NetworkService n, Infrastructure i, boolean flag)
           
 
Method Summary
 void doConnection(Socket s, NetworkService n, Infrastructure i, boolean flag)
          Créer une nouvelle connection entrante.
 void endSend(int jeton)
          End of message.
 InetAddress getHost()
          Renvoie le nom de l'hôte local
Utiliser par NetworkService lors de la création d'une connection
 void run()
          Attend des requêtes entrantes et les traitent
 void send(int jeton, Serializable msg)
          Envoie un message.
 int startSend(Serializable msg)
          prend un jeton et envoie le debut message.
ce jeton permet d'éviter d'envoyer deux messages simultanement.
 String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

eom

public static final String eom
End of message
Constructor Detail

NetConnection

public NetConnection(Socket s,
                     NetworkService n,
                     Infrastructure i)
Créer une nouvelle connection entrante.
Parameters:
s - La socket qui rentre
n - Le server reseau de Fungus

NetConnection

public NetConnection(Socket s,
                     NetworkService n,
                     Infrastructure i,
                     boolean flag)
Method Detail

doConnection

public void doConnection(Socket s,
                         NetworkService n,
                         Infrastructure i,
                         boolean flag)
Créer une nouvelle connection entrante.
Parameters:
s - La sockect qui rentre
n - Le server reseau de Fungus
flag - si true alors connection sortante.

getHost

public InetAddress getHost()
Renvoie le nom de l'hôte local
Utiliser par NetworkService lors de la création d'une connection
Returns:
a String value

run

public void run()
Attend des requêtes entrantes et les traitent
Overrides:
run in class Thread

startSend

public int startSend(Serializable msg)
prend un jeton et envoie le debut message.
ce jeton permet d'éviter d'envoyer deux messages simultanement.
Parameters:
msg - a Serializable value
Returns:
le jeton

send

public void send(int jeton,
                 Serializable msg)
Envoie un message.
Parameters:
jeton - message number
msg - a String value

endSend

public void endSend(int jeton)
End of message. Remove the lock.
Parameters:
jeton - the message number

toString

public String toString()
Overrides:
toString in class Thread