public interface PacketReceiver
Encapsulates a passive acceptor of packets. This acceptor is
passive in the sense that it uses the caller's thread to
accept and assemble the incoming packet.
PacketReceiver
s, together with their corresponding
PacketSender
s, form the communication layer
underneath the distributed network of Siena components.
The implementations of Siena (see HierarchicalDispatcher
and ThinClient
) use a
PacketReceiver
as their acceptor of external
subscriptions, notifications, etc.
PacketSender
Modifier and Type | Method and Description |
---|---|
byte[] |
address()
external address for this receiver.
|
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.
|
byte[] address()
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.
PacketSender
,
PacketSenderFactory
int receive(byte[] packet) throws PacketReceiverException
PacketReceiverException
- in case an error occurrs
while reading.int receive(byte[] packet, long timeout) throws PacketReceiverException, TimeoutExpired
PacketReceiverException
- in case an error occurrs
while reading.TimeoutExpired
- in case the timout expires before a
packet is availablevoid shutdown() throws PacketReceiverException
PacketReceiverException
Copyright © 2005-2011 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga