servlet
Class PeerCommunication

java.lang.Object
  extended by java.lang.Thread
      extended by servlet.PeerCommunication
All Implemented Interfaces:
java.lang.Runnable

public class PeerCommunication
extends java.lang.Thread

This thread magages the communication with another user.

Author:
Alessandro Franchini

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 PeerInterface pi
           
 java.net.Socket so
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PeerCommunication(java.net.Socket soc, User name, Message mx)
          The constructor
 
Method Summary
 void run()
          Receives messages and prints them in the graphic interface
 void sendMex(Message mx)
          Thus method sends a message to the user.
 
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

so

public java.net.Socket so

pi

public PeerInterface pi
Constructor Detail

PeerCommunication

public PeerCommunication(java.net.Socket soc,
                         User name,
                         Message mx)
The constructor

Parameters:
soc - the socket
name - the user
mx - the first received message
Method Detail

sendMex

public void sendMex(Message mx)
Thus method sends a message to the user.

Parameters:
mx - the message

run

public void run()
Receives messages and prints them in the graphic interface

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