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()
PacketReceiver
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.
address
in interface PacketReceiver
PacketSender
,
PacketSenderFactory
public int receive(byte[] packet) throws PacketReceiverException
PacketReceiver
receive
in interface PacketReceiver
PacketReceiverException
- in case an error occurrs
while reading.public int receive(byte[] packet, long timeout) throws PacketReceiverException, TimeoutExpired
PacketReceiver
receive
in interface PacketReceiver
PacketReceiverException
- in case an error occurrs
while reading.TimeoutExpired
- in case the timout expires before a
packet is availablepublic void shutdown() throws PacketReceiverException
PacketReceiver
shutdown
in interface PacketReceiver
PacketReceiverException
public 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