UDPClient
Keywords: uk.ac.ic.doc.automed.p2p.communication.UDPClient 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 UDPClient

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

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

    public class UDPClient

extends AbstractClient

Field Summary

Fields inherited from class uk.ac.ic.doc.automed.p2p.communication.AbstractClient
`ackExpected, dataToSend, handler, serverHostName, serverPort`

Constructor Summary
`UDPClient(java.lang.String serverHostName, int serverPort, RequestListener handler)` Creates a new instance of UDPClient
`UDPClient(java.lang.String serverHostName, int serverPort, RequestListener handler, byte[] dataToSend)` Creates a new instance of UDPClient

Method Summary
`byte[]` | `getReceivedData()` Get the data received from server
`void` | `handleAction()` Handle thread's interrupted action
`void` | `runAction()` Implement UDP communication process
`void` | `setDataToSend(byte[] dataToSend, boolean ackExpected)` Set the data to send (with acknowledgement specified)

Methods inherited from class uk.ac.ic.doc.automed.p2p.communication.AbstractClient
`setDataToSend`

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

Constructor Detail

### UDPClient

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

  Creates a new instance of UDPClient

  Parameters:
    `serverHostName` - host name of the UDP server
    `serverPort` - UDP port on server
    `handler` - an `RequestListener` object for processing messages
    `dataToSend` - in array of bytes

### UDPClient

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

  Creates a new instance of UDPClient

  Parameters:
    `serverHostName` - host name of the UDP server
    `serverPort` - UDP port on server

Method Detail

### setDataToSend

    public void setDataToSend(byte[] dataToSend,
                              boolean ackExpected)

  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 void runAction()
                   throws AutoMedException

  Implement UDP communication process

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

### handleAction

    public void handleAction()

  Handle thread's interrupted action

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

### getReceivedData

    public byte[] getReceivedData()

  Get the data received from server

  Returns:
    byte[] an array of bytes representing the received data

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