[](https://github.com/ypo/flute/actions/workflows/rust.yml)
[](https://github.com/ypo/flute/actions/workflows/python.yml)
[](https://docs.rs/crate/flute/)
[](https://crates.io/crates/flute/)
[](https://deps.rs/repo/github/ypo/flute)
[](https://codecov.io/gh/ypo/flute)
## FLUTE - File Delivery over Unidirectional Transport
Massively scalable multicast distribution solution
The library implements a unidirectional file delivery, without the need of a return channel.
## RFC
This library implements the following RFCs
| RFC | Title | Link |
| -------- | ---------- | -----------|
| RFC 6726 | FLUTE - File Delivery over Unidirectional Transport | <https://www.rfc-editor.org/rfc/rfc6726.html> |
| RFC 5775 | Asynchronous Layered Coding (ALC) Protocol Instantiation | <https://www.rfc-editor.org/rfc/rfc5775.html> |
| RFC 5661 | Layered Coding Transport (LCT) Building Block | <https://www.rfc-editor.org/rfc/rfc5651> |
| RFC 5052 | Forward Error Correction (FEC) Building Block | <https://www.rfc-editor.org/rfc/rfc5052> |
| RFC 5510 | Reed-Solomon Forward Error Correction (FEC) Schemes | <https://www.rfc-editor.org/rfc/rfc5510.html> |
| 3GPP TS 26.346 | Extended FLUTE FDT Schema (7.2.10) | <https://www.etsi.org/deliver/etsi_ts/126300_126399/126346/17.03.00_60/ts_126346v170300p.pdf> |
## UDP/IP Multicast files sender
Transfer files over a UDP/IP network
```rust
use flute::sender::Sender;
use flute::sender::ObjectDesc;
use flute::core::lct::Cenc;
use flute::core::UDPEndpoint;
use std::net::UdpSocket;
use std::time::SystemTime;
// Create UDP Socket
let udp_socket = UdpSocket::bind("0.0.0.0:0").unwrap();
udp_socket.connect("224.0.0.1:3400").expect("Connection failed");
// Create FLUTE Sender
let tsi = 1;
let oti = Default::default();
let config = Default::default();
let endpoint = UDPEndpoint::new(None, "224.0.0.1".to_string(), 3400);
let mut sender = Sender::new(endpoint, tsi, &oti, &config);
// Add object(s) (files) to the FLUTE sender (priority queue 0)
let obj = ObjectDesc::create_from_buffer(b"hello world", "text/plain",
&url::Url::parse("file:///hello.txt").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();
sender.add_object(0, obj);
// Always call publish after adding objects
sender.publish(SystemTime::now());
// Send FLUTE packets over UDP/IP
while let Some(pkt) = sender.read(SystemTime::now()) {
udp_socket.send(&pkt).unwrap();
std::thread::sleep(std::time::Duration::from_millis(1));
}
```
## UDP/IP Multicast files receiver
Receive files from a UDP/IP network
```rust
use flute::receiver::{writer, MultiReceiver};
use flute::core::UDPEndpoint;
use std::net::UdpSocket;
use std::time::SystemTime;
use std::rc::Rc;
// Create UDP/IP socket to receive FLUTE pkt
let endpoint = UDPEndpoint::new(None, "224.0.0.1".to_string(), 3400);
let udp_socket = UdpSocket::bind(format!("{}:{}", endpoint.destination_group_address, endpoint.port)).expect("Fail to bind");
// Create a writer able to write received files to the filesystem
let writer = Rc::new(writer::ObjectWriterFSBuilder::new(&std::path::Path::new("./flute_dir"))
.unwrap_or_else(|_| std::process::exit(0)));
// Create a multi-receiver capable of de-multiplexing several FLUTE sessions
let mut receiver = MultiReceiver::new(writer, None, false);
// Receive pkt from UDP/IP socket and push it to the FLUTE receiver
let mut buf = [0; 2048];
loop {
let (n, _src) = udp_socket.recv_from(&mut buf).expect("Failed to receive data");
let now = SystemTime::now();
receiver.push(&endpoint, &buf[..n], now).unwrap();
receiver.cleanup(now);
}
```
## Application-Level Forward Erasure Correction (AL-FEC)
The following error recovery algorithms are supported
- [X] No-code
- [X] Reed-Solomon GF 2^8
- [X] Reed-Solomon GF 2^8 Under Specified
- [ ] Reed-Solomon GF 2^16
- [ ] Reed-Solomon GF 2^m
- [X] RaptorQ
- [X] Raptor
The `Oti` module provides an implementation of the Object Transmission Information (OTI)
used to configure Forward Error Correction (FEC) encoding in the FLUTE protocol.
```rust
use flute::sender::Sender;
use flute::core::Oti;
use flute::core::UDPEndpoint;
// Reed Solomon 2^8 with encoding blocks composed of
// 60 source symbols and 4 repair symbols of 1424 bytes per symbol
let endpoint = UDPEndpoint::new(None, "224.0.0.1".to_string(), 3400);
let oti = Oti::new_reed_solomon_rs28(1424, 60, 4).unwrap();
let mut sender = Sender::new(endpoint, 1, &oti, &Default::default());
```
## Content Encoding (CENC)
The following schemes are supported during the transmission/reception
- [x] Null (no compression)
- [x] Deflate
- [x] Zlib
- [x] Gzip
## Files multiplex / Blocks interleave
The FLUTE Sender is able to transfer multiple files in parallel by interleaving packets from each file. For example:
**Pkt file1** -> Pkt file2 -> Pkt file3 -> **Pkt file1** -> Pkt file2 -> Pkt file3 ...
The Sender can interleave blocks within a single file.
The following example shows Encoding Symbols (ES) from different blocks (B) are interleaved. For example:
**(B 1,ES 1)**->(B 2,ES 1)->(B 3,ES 1)->**(B 1,ES 2)**->(B 2,ES 2)...
To configure the multiplexing, use the `Config` struct as follows:
```rust
use flute::sender::Sender;
use flute::sender::Config;
use flute::sender::PriorityQueue;
use flute::core::UDPEndpoint;
let mut config = Config {
// Interleave a maximum of 3 blocks within each file
interleave_blocks: 3,
..Default::default()
};
// Interleave a maximum of 3 files in priority queue '0'
config.set_priority_queue(PriorityQueue::HIGHEST, PriorityQueue::new(3));
let endpoint = UDPEndpoint::new(None, "224.0.0.1".to_string(), 3400);
let mut sender = Sender::new(endpoint, 1, &Default::default(), &config);
```
## Priority Queues
FLUTE sender can be configured with multiple queues, each having a different priority level.
Files in higher priority queues are always transferred before files in lower priority queues.
Transfer of files in lower priority queues is paused while there are files to be transferred in higher priority queues.
```rust
use flute::sender::Sender;
use flute::sender::Config;
use flute::sender::PriorityQueue;
use flute::core::UDPEndpoint;
use flute::sender::ObjectDesc;
use flute::core::lct::Cenc;
// Create a default configuration
let mut config: flute::sender::Config = Default::default();
// Configure the HIGHEST priority queue with a capacity of 3 simultaneous file transfer
config.set_priority_queue(PriorityQueue::HIGHEST, PriorityQueue::new(3));
// Configure the LOW priority queue with a capacity of 1 file transfer at a time
config.set_priority_queue(PriorityQueue::LOW, PriorityQueue::new(1));
let endpoint = UDPEndpoint::new(None, "224.0.0.1".to_string(), 3400);
let mut sender = Sender::new(endpoint, 1, &Default::default(), &config);
// Create an ObjectDesc for a low priority file
let low_priority_obj = ObjectDesc::create_from_buffer(b"low priority", "text/plain",
&url::Url::parse("file:///low_priority.txt").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();
// Create an ObjectDesc for a high priority file
let high_priority_obj = ObjectDesc::create_from_buffer(b"high priority", "text/plain",
&url::Url::parse("file:///high_priority.txt").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();
// Put Object to the low priority queue
sender.add_object(PriorityQueue::LOW, low_priority_obj);
// Put Object to the high priority queue
sender.add_object(PriorityQueue::HIGHEST, high_priority_obj);
```
## Bitrate Control
The FLUTE library does not provide a built-in bitrate control mechanism.
Users are responsible for controlling the bitrate by sending packets at a specific rate.
However, the library offers a way to control the target transfer duration or the target transfer end time for each file individually.
To ensure proper functionality, the target transfer mechanism requires that the overall bitrate is sufficiently high.
### Target Transfer Duration
The sender will attempt to transfer the file within the specified duration.
```rust
use flute::sender::Sender;
use flute::sender::ObjectDesc;
use flute::sender::TargetAcquisition;
use flute::core::lct::Cenc;
use flute::core::UDPEndpoint;
use std::net::UdpSocket;
use std::time::SystemTime;
// Create UDP Socket
let udp_socket = UdpSocket::bind("0.0.0.0:0").unwrap();
udp_socket.connect("224.0.0.1:3400").expect("Connection failed");
// Create FLUTE Sender
let tsi = 1;
let oti = Default::default();
let config = Default::default();
let endpoint = UDPEndpoint::new(None, "224.0.0.1".to_string(), 3400);
let mut sender = Sender::new(endpoint, tsi, &oti, &config);
// Create an Object
let mut obj = ObjectDesc::create_from_buffer(b"hello world", "text/plain",
&url::Url::parse("file:///hello.txt").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();
// Set the Target Transfer Duration of this object to 2 seconds
obj.target_acquisition = Some(TargetAcquisition::WithinDuration(std::time::Duration::from_secs(2)));
// Add object(s) (files) to the FLUTE sender (priority queue 0)
sender.add_object(0, obj);
// Always call publish after adding objects
sender.publish(SystemTime::now());
// Send FLUTE packets over UDP/IP
while sender.nb_objects() > 0 {
if let Some(pkt) = sender.read(SystemTime::now()) {
udp_socket.send(&pkt).unwrap();
} else {
std::thread::sleep(std::time::Duration::from_millis(1));
}
}
```
### Target Time to End Transfer
The sender will try to finish the file at the specified time.
```rust
use flute::sender::Sender;
use flute::sender::ObjectDesc;
use flute::sender::TargetAcquisition;
use flute::core::lct::Cenc;
use flute::core::UDPEndpoint;
use std::net::UdpSocket;
use std::time::SystemTime;
// Create UDP Socket
let udp_socket = UdpSocket::bind("0.0.0.0:0").unwrap();
udp_socket.connect("224.0.0.1:3400").expect("Connection failed");
// Create FLUTE Sender
let tsi = 1;
let oti = Default::default();
let config = Default::default();
let endpoint = UDPEndpoint::new(None, "224.0.0.1".to_string(), 3400);
let mut sender = Sender::new(endpoint, tsi, &oti, &config);
// Create an Object
let mut obj = ObjectDesc::create_from_buffer(b"hello world", "text/plain",
&url::Url::parse("file:///hello.txt").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();
// Set the Target Transfer End Time of this object to 10 seconds from now
let target_end_time = SystemTime::now() + std::time::Duration::from_secs(10);
obj.target_acquisition = Some(TargetAcquisition::WithinTime(target_end_time));
// Add object(s) (files) to the FLUTE sender (priority queue 0)
sender.add_object(0, obj);
// Always call publish after adding objects
sender.publish(SystemTime::now());
// Send FLUTE packets over UDP/IP
while sender.nb_objects() > 0 {
if let Some(pkt) = sender.read(SystemTime::now()) {
udp_socket.send(&pkt).unwrap();
} else {
std::thread::sleep(std::time::Duration::from_millis(1));
}
}
```
# Python bindings
[](https://badge.fury.io/py/flute-alc)
## Installation
```bash
pip install flute-alc
```
## Example
Flute Sender python example
```python
from flute import sender
# Flute Sender config parameters
sender_config = sender.Config()
# Object transmission parameters (no_code => no FEC)
# encoding symbol size : 1400 bytes
# Max source block length : 64 encoding symbols
oti = sender.Oti.new_no_code(1400, 64)
# Create FLUTE Sender
flute_sender = sender.Sender(1, oti, sender_config)
# Transfer a file
flute_sender.add_file("/path/to/file", 0, "application/octet-stream", None, None)
flute_sender.publish()
while True:
alc_pkt = flute_sender.read()
if alc_pkt == None:
break
#TODO Send alc_pkt over UDP/IP
```
Flute Receiver python example
```python
from flute import receiver
# Write received objects to a destination folder
receiver_writer = receiver.ObjectWriterBuilder("/path/to/dest")
# FLUTE Receiver configuration parameters
receiver_config = receiver.Config()
tsi = 1
# Create a FLUTE receiver with the specified endpoint, tsi, writer, and configuration
udp_endpoint = receiver.UDPEndpoint("224.0.0.1", 1234)
flute_receiver = receiver.Receiver(udp_endpoint, tsi, receiver_writer, receiver_config)
while True:
# Receive LCT/ALC packet from UDP/IP multicast (Implement your own receive_from_udp_socket() function)
# Note: FLUTE does not handle the UDP/IP layer, you need to implement the socket reception mechanism yourself
pkt = receive_from_udp_socket()
# Push the received packet to the FLUTE receiver
flute_receiver.push(bytes(pkt))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ypo/flute",
"name": "flute-alc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "multicast, network, broadcast, 5g, satellite",
"author": "Yannick Poirier <contact@yannickpoirier.fr>",
"author_email": "Yannick Poirier <contact@yannickpoirier.fr>",
"download_url": null,
"platform": null,
"description": "[](https://github.com/ypo/flute/actions/workflows/rust.yml)\n[](https://github.com/ypo/flute/actions/workflows/python.yml)\n[](https://docs.rs/crate/flute/)\n[](https://crates.io/crates/flute/)\n[](https://deps.rs/repo/github/ypo/flute)\n[](https://codecov.io/gh/ypo/flute)\n\n## FLUTE - File Delivery over Unidirectional Transport\n\n\nMassively scalable multicast distribution solution\n\nThe library implements a unidirectional file delivery, without the need of a return channel.\n\n\n## RFC\n\nThis library implements the following RFCs\n\n| RFC | Title | Link |\n| -------- | ---------- | -----------|\n| RFC 6726 | FLUTE - File Delivery over Unidirectional Transport | <https://www.rfc-editor.org/rfc/rfc6726.html> |\n| RFC 5775 | Asynchronous Layered Coding (ALC) Protocol Instantiation | <https://www.rfc-editor.org/rfc/rfc5775.html> |\n| RFC 5661 | Layered Coding Transport (LCT) Building Block | <https://www.rfc-editor.org/rfc/rfc5651> |\n| RFC 5052 | Forward Error Correction (FEC) Building Block | <https://www.rfc-editor.org/rfc/rfc5052> |\n| RFC 5510 | Reed-Solomon Forward Error Correction (FEC) Schemes | <https://www.rfc-editor.org/rfc/rfc5510.html> |\n| 3GPP TS 26.346 | Extended FLUTE FDT Schema (7.2.10) | <https://www.etsi.org/deliver/etsi_ts/126300_126399/126346/17.03.00_60/ts_126346v170300p.pdf> |\n\n## UDP/IP Multicast files sender\n\nTransfer files over a UDP/IP network\n\n```rust\nuse flute::sender::Sender;\nuse flute::sender::ObjectDesc;\nuse flute::core::lct::Cenc;\nuse flute::core::UDPEndpoint;\nuse std::net::UdpSocket;\nuse std::time::SystemTime;\n\n// Create UDP Socket\nlet udp_socket = UdpSocket::bind(\"0.0.0.0:0\").unwrap();\nudp_socket.connect(\"224.0.0.1:3400\").expect(\"Connection failed\");\n\n// Create FLUTE Sender\nlet tsi = 1;\nlet oti = Default::default();\nlet config = Default::default();\nlet endpoint = UDPEndpoint::new(None, \"224.0.0.1\".to_string(), 3400);\nlet mut sender = Sender::new(endpoint, tsi, &oti, &config);\n\n// Add object(s) (files) to the FLUTE sender (priority queue 0)\nlet obj = ObjectDesc::create_from_buffer(b\"hello world\", \"text/plain\",\n&url::Url::parse(\"file:///hello.txt\").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();\nsender.add_object(0, obj);\n\n// Always call publish after adding objects\nsender.publish(SystemTime::now());\n\n// Send FLUTE packets over UDP/IP\nwhile let Some(pkt) = sender.read(SystemTime::now()) {\n udp_socket.send(&pkt).unwrap();\n std::thread::sleep(std::time::Duration::from_millis(1));\n}\n\n```\n## UDP/IP Multicast files receiver\n\nReceive files from a UDP/IP network\n\n```rust\nuse flute::receiver::{writer, MultiReceiver};\nuse flute::core::UDPEndpoint;\nuse std::net::UdpSocket;\nuse std::time::SystemTime;\nuse std::rc::Rc;\n\n// Create UDP/IP socket to receive FLUTE pkt\nlet endpoint = UDPEndpoint::new(None, \"224.0.0.1\".to_string(), 3400);\nlet udp_socket = UdpSocket::bind(format!(\"{}:{}\", endpoint.destination_group_address, endpoint.port)).expect(\"Fail to bind\");\n\n// Create a writer able to write received files to the filesystem\nlet writer = Rc::new(writer::ObjectWriterFSBuilder::new(&std::path::Path::new(\"./flute_dir\"))\n .unwrap_or_else(|_| std::process::exit(0)));\n\n// Create a multi-receiver capable of de-multiplexing several FLUTE sessions\nlet mut receiver = MultiReceiver::new(writer, None, false);\n\n// Receive pkt from UDP/IP socket and push it to the FLUTE receiver\nlet mut buf = [0; 2048];\nloop {\n let (n, _src) = udp_socket.recv_from(&mut buf).expect(\"Failed to receive data\");\n let now = SystemTime::now();\n receiver.push(&endpoint, &buf[..n], now).unwrap();\n receiver.cleanup(now);\n}\n```\n## Application-Level Forward Erasure Correction (AL-FEC)\n\nThe following error recovery algorithms are supported\n\n- [X] No-code\n- [X] Reed-Solomon GF 2^8\n- [X] Reed-Solomon GF 2^8 Under Specified\n- [ ] Reed-Solomon GF 2^16\n- [ ] Reed-Solomon GF 2^m\n- [X] RaptorQ\n- [X] Raptor\n\nThe `Oti` module provides an implementation of the Object Transmission Information (OTI)\nused to configure Forward Error Correction (FEC) encoding in the FLUTE protocol.\n\n```rust\nuse flute::sender::Sender;\nuse flute::core::Oti;\nuse flute::core::UDPEndpoint;\n\n// Reed Solomon 2^8 with encoding blocks composed of\n// 60 source symbols and 4 repair symbols of 1424 bytes per symbol\nlet endpoint = UDPEndpoint::new(None, \"224.0.0.1\".to_string(), 3400);\nlet oti = Oti::new_reed_solomon_rs28(1424, 60, 4).unwrap();\nlet mut sender = Sender::new(endpoint, 1, &oti, &Default::default());\n```\n\n## Content Encoding (CENC)\n\nThe following schemes are supported during the transmission/reception\n\n- [x] Null (no compression)\n- [x] Deflate\n- [x] Zlib\n- [x] Gzip\n\n## Files multiplex / Blocks interleave\n\nThe FLUTE Sender is able to transfer multiple files in parallel by interleaving packets from each file. For example:\n\n**Pkt file1** -> Pkt file2 -> Pkt file3 -> **Pkt file1** -> Pkt file2 -> Pkt file3 ...\n\nThe Sender can interleave blocks within a single file.\nThe following example shows Encoding Symbols (ES) from different blocks (B) are interleaved. For example:\n\n**(B 1,ES 1)**->(B 2,ES 1)->(B 3,ES 1)->**(B 1,ES 2)**->(B 2,ES 2)...\n\nTo configure the multiplexing, use the `Config` struct as follows:\n\n```rust\nuse flute::sender::Sender;\nuse flute::sender::Config;\nuse flute::sender::PriorityQueue;\nuse flute::core::UDPEndpoint;\n\nlet mut config = Config {\n // Interleave a maximum of 3 blocks within each file\n interleave_blocks: 3,\n ..Default::default()\n};\n\n// Interleave a maximum of 3 files in priority queue '0'\nconfig.set_priority_queue(PriorityQueue::HIGHEST, PriorityQueue::new(3));\n\nlet endpoint = UDPEndpoint::new(None, \"224.0.0.1\".to_string(), 3400);\nlet mut sender = Sender::new(endpoint, 1, &Default::default(), &config);\n```\n\n## Priority Queues\n\nFLUTE sender can be configured with multiple queues, each having a different priority level.\nFiles in higher priority queues are always transferred before files in lower priority queues.\nTransfer of files in lower priority queues is paused while there are files to be transferred in higher priority queues.\n\n```rust\n\nuse flute::sender::Sender;\nuse flute::sender::Config;\nuse flute::sender::PriorityQueue;\nuse flute::core::UDPEndpoint;\nuse flute::sender::ObjectDesc;\nuse flute::core::lct::Cenc;\n\n// Create a default configuration\nlet mut config: flute::sender::Config = Default::default();\n\n// Configure the HIGHEST priority queue with a capacity of 3 simultaneous file transfer\nconfig.set_priority_queue(PriorityQueue::HIGHEST, PriorityQueue::new(3));\n\n// Configure the LOW priority queue with a capacity of 1 file transfer at a time\nconfig.set_priority_queue(PriorityQueue::LOW, PriorityQueue::new(1));\n\nlet endpoint = UDPEndpoint::new(None, \"224.0.0.1\".to_string(), 3400);\nlet mut sender = Sender::new(endpoint, 1, &Default::default(), &config);\n\n// Create an ObjectDesc for a low priority file\nlet low_priority_obj = ObjectDesc::create_from_buffer(b\"low priority\", \"text/plain\",\n&url::Url::parse(\"file:///low_priority.txt\").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();\n\n// Create an ObjectDesc for a high priority file\nlet high_priority_obj = ObjectDesc::create_from_buffer(b\"high priority\", \"text/plain\",\n&url::Url::parse(\"file:///high_priority.txt\").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();\n\n// Put Object to the low priority queue\nsender.add_object(PriorityQueue::LOW, low_priority_obj);\n\n// Put Object to the high priority queue\nsender.add_object(PriorityQueue::HIGHEST, high_priority_obj);\n```\n\n## Bitrate Control\nThe FLUTE library does not provide a built-in bitrate control mechanism.\nUsers are responsible for controlling the bitrate by sending packets at a specific rate.\nHowever, the library offers a way to control the target transfer duration or the target transfer end time for each file individually.\n\nTo ensure proper functionality, the target transfer mechanism requires that the overall bitrate is sufficiently high.\n\n### Target Transfer Duration\n\nThe sender will attempt to transfer the file within the specified duration.\n\n```rust\n\nuse flute::sender::Sender;\nuse flute::sender::ObjectDesc;\nuse flute::sender::TargetAcquisition;\nuse flute::core::lct::Cenc;\nuse flute::core::UDPEndpoint;\nuse std::net::UdpSocket;\nuse std::time::SystemTime;\n\n// Create UDP Socket\nlet udp_socket = UdpSocket::bind(\"0.0.0.0:0\").unwrap();\nudp_socket.connect(\"224.0.0.1:3400\").expect(\"Connection failed\");\n\n// Create FLUTE Sender\nlet tsi = 1;\nlet oti = Default::default();\nlet config = Default::default();\nlet endpoint = UDPEndpoint::new(None, \"224.0.0.1\".to_string(), 3400);\nlet mut sender = Sender::new(endpoint, tsi, &oti, &config);\n\n// Create an Object\nlet mut obj = ObjectDesc::create_from_buffer(b\"hello world\", \"text/plain\",\n&url::Url::parse(\"file:///hello.txt\").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();\n\n// Set the Target Transfer Duration of this object to 2 seconds\nobj.target_acquisition = Some(TargetAcquisition::WithinDuration(std::time::Duration::from_secs(2)));\n\n// Add object(s) (files) to the FLUTE sender (priority queue 0)\nsender.add_object(0, obj);\n\n// Always call publish after adding objects\nsender.publish(SystemTime::now());\n\n// Send FLUTE packets over UDP/IP\nwhile sender.nb_objects() > 0 {\n if let Some(pkt) = sender.read(SystemTime::now()) {\n udp_socket.send(&pkt).unwrap();\n } else {\n std::thread::sleep(std::time::Duration::from_millis(1));\n }\n}\n```\n\n### Target Time to End Transfer\n\nThe sender will try to finish the file at the specified time.\n\n```rust\n\nuse flute::sender::Sender;\nuse flute::sender::ObjectDesc;\nuse flute::sender::TargetAcquisition;\nuse flute::core::lct::Cenc;\nuse flute::core::UDPEndpoint;\nuse std::net::UdpSocket;\nuse std::time::SystemTime;\n\n// Create UDP Socket\nlet udp_socket = UdpSocket::bind(\"0.0.0.0:0\").unwrap();\nudp_socket.connect(\"224.0.0.1:3400\").expect(\"Connection failed\");\n\n// Create FLUTE Sender\nlet tsi = 1;\nlet oti = Default::default();\nlet config = Default::default();\nlet endpoint = UDPEndpoint::new(None, \"224.0.0.1\".to_string(), 3400);\nlet mut sender = Sender::new(endpoint, tsi, &oti, &config);\n\n// Create an Object\nlet mut obj = ObjectDesc::create_from_buffer(b\"hello world\", \"text/plain\",\n&url::Url::parse(\"file:///hello.txt\").unwrap(), 1, None, None, None, None, Cenc::Null, true, None, true).unwrap();\n\n// Set the Target Transfer End Time of this object to 10 seconds from now\nlet target_end_time = SystemTime::now() + std::time::Duration::from_secs(10);\nobj.target_acquisition = Some(TargetAcquisition::WithinTime(target_end_time));\n\n// Add object(s) (files) to the FLUTE sender (priority queue 0)\nsender.add_object(0, obj);\n\n// Always call publish after adding objects\nsender.publish(SystemTime::now());\n\n// Send FLUTE packets over UDP/IP\nwhile sender.nb_objects() > 0 {\n if let Some(pkt) = sender.read(SystemTime::now()) {\n udp_socket.send(&pkt).unwrap();\n } else {\n std::thread::sleep(std::time::Duration::from_millis(1));\n }\n}\n```\n\n# Python bindings\n\n[](https://badge.fury.io/py/flute-alc)\n\n## Installation\n\n```bash\npip install flute-alc\n```\n\n## Example\n\nFlute Sender python example\n\n```python\n from flute import sender\n\n # Flute Sender config parameters\n sender_config = sender.Config()\n\n # Object transmission parameters (no_code => no FEC)\n # encoding symbol size : 1400 bytes\n # Max source block length : 64 encoding symbols\n oti = sender.Oti.new_no_code(1400, 64)\n\n # Create FLUTE Sender\n flute_sender = sender.Sender(1, oti, sender_config)\n\n # Transfer a file \n flute_sender.add_file(\"/path/to/file\", 0, \"application/octet-stream\", None, None)\n flute_sender.publish()\n\n while True:\n alc_pkt = flute_sender.read()\n if alc_pkt == None:\n break\n\n #TODO Send alc_pkt over UDP/IP\n```\n\nFlute Receiver python example\n```python\n from flute import receiver\n\n # Write received objects to a destination folder\n receiver_writer = receiver.ObjectWriterBuilder(\"/path/to/dest\")\n\n # FLUTE Receiver configuration parameters\n receiver_config = receiver.Config()\n\n tsi = 1\n\n # Create a FLUTE receiver with the specified endpoint, tsi, writer, and configuration\n udp_endpoint = receiver.UDPEndpoint(\"224.0.0.1\", 1234)\n flute_receiver = receiver.Receiver(udp_endpoint, tsi, receiver_writer, receiver_config)\n\n while True:\n # Receive LCT/ALC packet from UDP/IP multicast (Implement your own receive_from_udp_socket() function)\n # Note: FLUTE does not handle the UDP/IP layer, you need to implement the socket reception mechanism yourself\n pkt = receive_from_udp_socket()\n\n # Push the received packet to the FLUTE receiver\n flute_receiver.push(bytes(pkt))\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "File Delivery over Unidirectional Transport (FLUTE)",
"version": "1.7.2",
"project_urls": {
"Homepage": "https://github.com/ypo/flute",
"Source Code": "https://github.com/ypo/flute"
},
"split_keywords": [
"multicast",
" network",
" broadcast",
" 5g",
" satellite"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bdbce6fc3fa942dd992ba14aff8f64eafb6c1d72c1ac4b597829412fa6926281",
"md5": "d69f0f5a0dec72620e6eb281b0584b1a",
"sha256": "62d8b87b6da01bcf2c00972615e91a9732b56b4b7aad202545a4fc731b5e0af5"
},
"downloads": -1,
"filename": "flute_alc-1.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "d69f0f5a0dec72620e6eb281b0584b1a",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.7",
"size": 1256680,
"upload_time": "2025-02-13T09:26:01",
"upload_time_iso_8601": "2025-02-13T09:26:01.956106Z",
"url": "https://files.pythonhosted.org/packages/bd/bc/e6fc3fa942dd992ba14aff8f64eafb6c1d72c1ac4b597829412fa6926281/flute_alc-1.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a7c721639027a23d5253acbd669ccb4a84844a5511644c015f211eb175120ef6",
"md5": "422ad3855b2b16d7b9e75cbd0f242e18",
"sha256": "d41624f524cf185022937b95402e1508aed433fd03b7c64701f331c0a1dc6d1a"
},
"downloads": -1,
"filename": "flute_alc-1.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "422ad3855b2b16d7b9e75cbd0f242e18",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.7",
"size": 1256129,
"upload_time": "2025-02-13T09:26:03",
"upload_time_iso_8601": "2025-02-13T09:26:03.934854Z",
"url": "https://files.pythonhosted.org/packages/a7/c7/21639027a23d5253acbd669ccb4a84844a5511644c015f211eb175120ef6/flute_alc-1.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c33ff1600ff4914ca60c8acd36f193d8a58ac1fb70e07aa36f8ab0ff6e1358e5",
"md5": "47520f31b8a1ee61bbfe00aca2ffe3a2",
"sha256": "d88eb88315ba528f0034ce9428c1d5589dbd525b9ba40b50cce7565b93e1a3f6"
},
"downloads": -1,
"filename": "flute_alc-1.7.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "47520f31b8a1ee61bbfe00aca2ffe3a2",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.7",
"size": 1258133,
"upload_time": "2025-02-13T09:26:05",
"upload_time_iso_8601": "2025-02-13T09:26:05.454816Z",
"url": "https://files.pythonhosted.org/packages/c3/3f/f1600ff4914ca60c8acd36f193d8a58ac1fb70e07aa36f8ab0ff6e1358e5/flute_alc-1.7.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "431be4cb000f26cf886aee6445fff21754dc0b84e8bab3c7bbbdff5a10f07998",
"md5": "affbf575e09058b1b5c6cf94a482f75c",
"sha256": "7cb3729bbdb97542dfea8817338849121f761342c80a3c88067811d8a2895429"
},
"downloads": -1,
"filename": "flute_alc-1.7.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "affbf575e09058b1b5c6cf94a482f75c",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.7",
"size": 1257310,
"upload_time": "2025-02-13T09:26:06",
"upload_time_iso_8601": "2025-02-13T09:26:06.726769Z",
"url": "https://files.pythonhosted.org/packages/43/1b/e4cb000f26cf886aee6445fff21754dc0b84e8bab3c7bbbdff5a10f07998/flute_alc-1.7.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "53d64c611c8cca3914ef1575db756a3f2edf02b249ad160af18271709ab28be5",
"md5": "04e10106e18c3fe6e0bb5607c1c27d46",
"sha256": "edf4deaf7f54d801cc0542c920abba3f78d6117dd6c2e2f2c9b7c6cb0535d972"
},
"downloads": -1,
"filename": "flute_alc-1.7.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "04e10106e18c3fe6e0bb5607c1c27d46",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.7",
"size": 1257810,
"upload_time": "2025-02-13T09:26:08",
"upload_time_iso_8601": "2025-02-13T09:26:08.130838Z",
"url": "https://files.pythonhosted.org/packages/53/d6/4c611c8cca3914ef1575db756a3f2edf02b249ad160af18271709ab28be5/flute_alc-1.7.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7e53f14238cb28c75cb54190b20fe61498ef89bf2a2d252130c500853d340e07",
"md5": "8e7f1f7a1ee4caf22195580444a4127d",
"sha256": "4a2b4841d88d3554dd03ded860d58d73019970a54a941eada4619b2d6e07d412"
},
"downloads": -1,
"filename": "flute_alc-1.7.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "8e7f1f7a1ee4caf22195580444a4127d",
"packagetype": "bdist_wheel",
"python_version": "pp39",
"requires_python": ">=3.7",
"size": 1258138,
"upload_time": "2025-02-13T09:26:09",
"upload_time_iso_8601": "2025-02-13T09:26:09.525775Z",
"url": "https://files.pythonhosted.org/packages/7e/53/f14238cb28c75cb54190b20fe61498ef89bf2a2d252130c500853d340e07/flute_alc-1.7.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-13 09:26:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ypo",
"github_project": "flute",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "flute-alc"
}