MultiPacketReceiver (Siena 2.0.4 API Documentation)
Date: 2015-05-17

siena.comm

## Class MultiPacketReceiver

- java.lang.Object
- - siena.comm.MultiPacketReceiver

- All Implemented Interfaces:
    PacketReceiver

      public class MultiPacketReceiver
      extends java.lang.Object
      implements PacketReceiver

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `PacketQueue` | `inputQueue`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiPacketReceiver()`
    `MultiPacketReceiver(int queuesize)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDefaultReceiver(PacketReceiver rec, int threads)`
    `void` | `addReceiver(PacketReceiver rec, int threads)`
    `byte[]` | `address()` external address for this receiver.
    `PacketReceiver` | `getDefaultReceiver()`
    `boolean` | `hasDefaultReceiver()`
    `int` | `receive(byte[] packet)` receives a packet in the given buffer.
    `int` | `receive(byte[] packet, long timeout)` receives a packet in the given buffer, with the given timeout.
    `void` | `shutdown()` closes the receiver.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### inputQueue

          public PacketQueue inputQueue

  - ### Constructor Detail

    - #### MultiPacketReceiver

          public MultiPacketReceiver()

    - #### MultiPacketReceiver

          public MultiPacketReceiver(int queuesize)

  - ### Method Detail

    - #### address

          public byte[] address()

      Description copied from interface: `PacketReceiver`
      external address for this receiver. An external address must allow other applications to contact this receiver. Every implementation of this interface must define an address format that is compatible (i.e., that does not conflict) with every other implementation. Notice also that every implementation of a `PacketReceiver` must have a corresponding `PacketSender`, and that `PacketSenderFactory` must understand its address to construct the corresponding `PacketSender`.

      In order to allow separate implementations to share the same global address space, every implementation must be associated with a unique schema. A schema is simply an identifier for a specitic receiver/sender implementation. An external address must therefore have the following general syntax:
      address ::= schema`:`schema-dependent-part
      schema ::= a character string not containing the ":" character
      schema-dependent-part ::= implementation-dependent part. Every implementation is free to define an appropriate syntax for this part of the address string.``

      Specified by:
        `address` in interface `PacketReceiver`
      See Also:
        `PacketSender`, `PacketSenderFactory`

    - #### receive

          public int receive(byte[] packet)
                      throws PacketReceiverException

      Description copied from interface: `PacketReceiver`
      receives a packet in the given buffer. This method must be reentrant. Siena clients and servers must be able to use several threads to receive packets from the same receiver.
      Specified by:
        `receive` in interface `PacketReceiver`
      Returns:
        the number of bytes read into the buffer. The return value must not be negative. On error conditions, this method must throw an exception.
      Throws:
        `PacketReceiverException` - in case an error occurrs while reading.

    - #### receive

          public int receive(byte[] packet,
                    long timeout)
                      throws PacketReceiverException,
                             TimeoutExpired

      Description copied from interface: `PacketReceiver`
      receives a packet in the given buffer, with the given timeout. This method must be reentrant. Siena clients and servers must be able to use several threads to receive packets from the same receiver.
      Specified by:
        `receive` in interface `PacketReceiver`
      Returns:
        the number of bytes read into the buffer. The return value must not be negative. On error conditions, this method must throw an exception.
      Throws:
        `PacketReceiverException` - in case an error occurrs while reading.
        `TimeoutExpired` - in case the timout expires before a packet is available

    - #### shutdown

          public void shutdown()
                        throws PacketReceiverException

      Description copied from interface: `PacketReceiver`
      closes the receiver.
      Specified by:
        `shutdown` in interface `PacketReceiver`
      Throws:
        `PacketReceiverException`

    - #### addReceiver

          public void addReceiver(PacketReceiver rec,
                         int threads)

    - #### addDefaultReceiver

          public void addDefaultReceiver(PacketReceiver rec,
                                int threads)

    - #### hasDefaultReceiver

          public boolean hasDefaultReceiver()

    - #### getDefaultReceiver

          public PacketReceiver getDefaultReceiver()

Copyright © 2000-2005 University of Colorado.
Copyright © 2005-2011 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga