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 |
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 |
eom
public static final String eom
- End of message
NetConnection
public NetConnection(Socket s,
NetworkService n,
Infrastructure i)
- Créer une nouvelle connection entrante.
- Parameters:
s
- La socket qui rentren
- Le server reseau de Fungus
NetConnection
public NetConnection(Socket s,
NetworkService n,
Infrastructure i,
boolean flag)
doConnection
public void doConnection(Socket s,
NetworkService n,
Infrastructure i,
boolean flag)
- Créer une nouvelle connection entrante.
- Parameters:
s
- La sockect qui rentren
- Le server reseau de Fungusflag
- 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 numbermsg
- 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