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

    java.lang.Object
      uk.ac.ic.doc.automed.p2p.communication.AbstractServer
          uk.ac.ic.doc.automed.p2p.communication.UDPServer

All Implemented Interfaces:
  Threadable

Direct Known Subclasses:
  MulticastServer

    public class UDPServer

extends AbstractServer

Field Summary
`protected JobHandler` | `jHandler`
`protected Queue` | `msgQueue`
`protected java.net.DatagramSocket` | `serverSocket`

Fields inherited from class uk.ac.ic.doc.automed.p2p.communication.AbstractServer
`isReady, numWorkers, readBufferSize, serverPort, timeOut`

Constructor Summary
`UDPServer(int serverPort, RequestListener handler, int timeOut, int numWorkers, int bufferSize)` Creates a new instance of UDPServer

Method Summary
`void` | `handleAction()` Handle actions
`protected void` | `init()` Initialises the UDP server socket and a `JobHandler` queue to handle messages received by this socket.
`protected void` | `initQueue()` Create a `QueueWorker` taking this instance as a job handler.
`void` | `runAction()` Implements the runnable action

Methods inherited from class uk.ac.ic.doc.automed.p2p.communication.AbstractServer
`getHandler, getReadyState, getServerPort, setReadyState`

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

Field Detail

### serverSocket

    protected java.net.DatagramSocket serverSocket

### msgQueue

    protected Queue msgQueue

### jHandler

    protected JobHandler jHandler

Constructor Detail

### UDPServer

    public UDPServer(int serverPort,
                     RequestListener handler,
                     int timeOut,
                     int numWorkers,
                     int bufferSize)
              throws CommunicationException

  Creates a new instance of UDPServer

  Throws:
    `CommunicationException`

Method Detail

### init

    protected void init()
                 throws CommunicationException

  Initialises the UDP server socket and a `JobHandler` queue to handle messages received by this socket.

  Throws:
    `CommunicationException`

### initQueue

    protected void initQueue()

  Create a `QueueWorker` taking this instance as a job handler. Then create a number of daemon threads having this worker as the handler.

### runAction

    public void runAction()
                   throws AutoMedException

  Implements the runnable action

  Specified by:
    `runAction` in interface `Threadable`
  Specified by:
    `runAction` in class `AbstractServer`
  Throws:
    `AutoMedException`

### handleAction

    public void handleAction()

  Handle actions

  Specified by:
    `handleAction` in interface `Threadable`
  Specified by:
    `handleAction` in class `AbstractServer`

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