uk.ac.ic.doc.automed.p2p.communication
Class TCPClient

java.lang.Object
  extended by uk.ac.ic.doc.automed.p2p.communication.AbstractClient
      extended by uk.ac.ic.doc.automed.p2p.communication.TCPClient
All Implemented Interfaces:
Threadable

public class TCPClient
extends AbstractClient


Field Summary
 
Fields inherited from class uk.ac.ic.doc.automed.p2p.communication.AbstractClient
ackExpected, dataToSend, handler, isReady, serverHostName, serverPort
 
Constructor Summary
TCPClient(RequestListener handler, int readBufferSize)
           
TCPClient(java.lang.String serverHostName, int serverPort, RequestListener handler, int readBufferSize)
           
 
Method Summary
 void handleAction()
          Handle thread's interrupted action
protected static byte[] readBytes(java.io.InputStream is, int bufferSize)
          Get bytes array from a TCP input stream
 void runAction()
          Implement TCP communication process
 
Methods inherited from class uk.ac.ic.doc.automed.p2p.communication.AbstractClient
getHandlerObject, getReadyState, setDataToSend, setReadyState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCPClient

public TCPClient(java.lang.String serverHostName,
                 int serverPort,
                 RequestListener handler,
                 int readBufferSize)

TCPClient

public TCPClient(RequestListener handler,
                 int readBufferSize)
Method Detail

runAction

public void runAction()
               throws AutoMedException
Implement TCP communication process

Specified by:
runAction in interface Threadable
Specified by:
runAction in class AbstractClient
Throws:
AutoMedException

handleAction

public void handleAction()
Handle thread's interrupted action

Specified by:
handleAction in interface Threadable
Specified by:
handleAction in class AbstractClient

readBytes

protected static byte[] readBytes(java.io.InputStream is,
                                  int bufferSize)
                           throws java.io.IOException
Get bytes array from a TCP input stream

Throws:
java.io.IOException