AbstractClient
Keywords: uk.ac.ic.doc.automed.p2p.communication.AbstractClient class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.ac.ic.doc.automed.p2p.communication
Class AbstractClient

    java.lang.Object
      uk.ac.ic.doc.automed.p2p.communication.AbstractClient

All Implemented Interfaces:
  uk.ac.ic.doc.automed.util.thread.Threadable

Direct Known Subclasses:
  TCPClient, UDPClient

    public abstract class AbstractClient

extends java.lang.Object
implements uk.ac.ic.doc.automed.util.thread.Threadable

Field Summary
`protected boolean` | `ackExpected`
`protected byte[]` | `dataToSend`
`protected RequestListener` | `handler`
`protected java.lang.String` | `serverHostName`
`protected int` | `serverPort`

Constructor Summary
`AbstractClient(java.lang.String serverHostName, int serverPort, RequestListener handler)`
`AbstractClient(java.lang.String serverHostName, int serverPort, RequestListener handler, byte[] dataToSend)`

Method Summary
`abstract void` | `handleAction()` Handle thread's interrupted action
`abstract void` | `runAction()` Implement communication process
`void` | `setDataToSend(byte[] dataToSend)` Set the data to send (with acknowledgement specified)

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### serverHostName

    protected java.lang.String serverHostName

### serverPort

    protected int serverPort

### handler

    protected RequestListener handler

### dataToSend

    protected byte[] dataToSend

### ackExpected

    protected boolean ackExpected

Constructor Detail

### AbstractClient

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

### AbstractClient

    public AbstractClient(java.lang.String serverHostName,
                          int serverPort,
                          RequestListener handler,
                          byte[] dataToSend)

Method Detail

### setDataToSend

    public void setDataToSend(byte[] dataToSend)

  Set the data to send (with acknowledgement specified)

  Parameters:
    `dataToSend` - an array of bytes to send via UDP
    `ackExpected` - whether or not to expect an acknowledgement

### runAction

    public abstract void runAction()
                            throws AutoMedException

  Implement communication process

  Specified by:
    `runAction` in interface `uk.ac.ic.doc.automed.util.thread.Threadable`
  Throws:
    `AutoMedException`

### handleAction

    public abstract void handleAction()

  Handle thread's interrupted action

  Specified by:
    `handleAction` in interface `uk.ac.ic.doc.automed.util.thread.Threadable`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD