public class MultiPacketReceiver extends java.lang.Object implements PacketReceiver
| Modifier and Type | Field and Description |
|---|---|
PacketQueue |
inputQueue |
| Constructor and Description |
|---|
MultiPacketReceiver() |
MultiPacketReceiver(int queuesize) |
| 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.
|
public PacketQueue inputQueue
public MultiPacketReceiver()
public MultiPacketReceiver(int queuesize)
public byte[] address()
PacketReceiverPacketReceiver
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.
address in interface PacketReceiverPacketSender,
PacketSenderFactorypublic int receive(byte[] packet)
throws PacketReceiverException
PacketReceiverreceive in interface PacketReceiverPacketReceiverException - in case an error occurrs
while reading.public int receive(byte[] packet,
long timeout)
throws PacketReceiverException,
TimeoutExpired
PacketReceiverreceive in interface PacketReceiverPacketReceiverException - in case an error occurrs
while reading.TimeoutExpired - in case the timout expires before a
packet is availablepublic void shutdown()
throws PacketReceiverException
PacketReceivershutdown in interface PacketReceiverPacketReceiverExceptionpublic void addReceiver(PacketReceiver rec, int threads)
public void addDefaultReceiver(PacketReceiver rec, int threads)
public boolean hasDefaultReceiver()
public PacketReceiver getDefaultReceiver()
Copyright © 2005-2011 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga