August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)
A pair of Pipelines for encoding (and decoding again) a stream of data such that is can be transported over an unreliable connection that may lose, duplicate or reorder data.
These components will ensure that data arrives in the right order and that duplicates are removed. However it cannot recover lost data.
Reliably transporting a file over multicast (assuming no packets are lost):
Pipeline(RateControlledFileReader("myfile"),
SRM_Sender(),
Multicast_transceiver("0.0.0.0", 0, "1.2.3.4", 1000),
).activate()
On the client:
class discardSeqnum(component):
def main(self):
while 1:
if self.dataReady("inbox"):
(_, data) = self.recv("inbox")
self.send(data,"outbox")
Pipeline( Multicast_transceiver("0.0.0.0", 1000, "1.2.3.4", 0)
SRM_Receiver(),
discardSeqnum(),
ConsoleEchoer()
).activate()
SRM_Sender is a Pipeline of three components:
SRM_Receiver is a Pipeline of three components:
These components will ensure that data arrives in the right order and that duplicates are removed. However it cannot recover lost data. But the final output is (seqnum,data) pairs - so there is enough information for the receiver to know that data has been lost.
The Annotator component receives data on its "inbox" inbox, and emits (seqnum, data) tuples on its "outbox" outbox. The sequence numbers start at 1 and increments by 1 for each item.
The Annotator component does not terminate and ignores messages arriving on its "control" inbox.
See documentation for the other components for details of their design and behaviour.
Annotator() -> new Annotator component.
Takes incoming data and outputs (n, data) where n is an incrementing sequence number, starting at 1.
Warning!
You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.
Main loop
RecoverOrder() -> new RecoverOrder component.
Receives and buffers (seqnum, data) pairs, and reorders them by ascending sequence number and emits them (when its internal buffer is full).
Warning!
You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.
Main loop.
Simple Reliable Multicast receiver.
Dechunks, deframes and recovers the order of a data stream that has been encoded by SRM_Sender.
Final emitted data is (seqnum, data) pairs.
This is a Pipeline of components.
Simple Reliable Multicast sender.
Sequence numbers, frames and chunks a data stream, making it suitable for sending over an unreliable connection that may lose, reorder or duplicate data. Can be decoded by SRM_Receiver.
This is a Pipeline of components.
Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!
Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.
-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT