tokio-multicast
Tokio-native helpers for UDP multicast.
Status
Implemented now:
- builder-based socket construction
- IPv4 ASM join, send, receive, and dynamic leave
- basic packet metadata via
recv_datagram() - platform split under
src/sys/
Not implemented yet:
- source-specific multicast data path
- rich destination/interface receive metadata
- full stream integration with
tokio-stream
Crate layout
This crate follows the structure proposed in internal-impl.MD:
builder.rsfor high-level constructionconfig.rsfor configuration stateerror.rsfor multicast-specific errorsinterface.rsandmembership.rsfor multicast intent typespacket.rsfor received datagram metadatasocket.rsfor the async multicast socketstream.rsfor stream-style consumption helpersraw.rsandsys/*for socket setup and platform adaptation
Quick start
use ;
use MulticastSocket;
async
Examples
cargo run --example simple_receivercargo run --example simple_sendercargo run --example send_and_receivecargo run --example diagnosticscargo run --example multi_groupcargo run --example ssm
simple_receiver blocks waiting for multicast traffic. send_and_receive demonstrates the full path in one process. diagnostics prints a quick environment support report. ssm is intentionally a placeholder example that currently demonstrates the not-yet-implemented path.
Diagnostics
Use tokio_multicast::diagnose_multicast() when you want a quick environment check before debugging higher-level multicast behavior.
If you need to control groups, interface index, or timeout, use diagnose_multicast_with_config(...).
let report = diagnose_multicast;
println!;
println!;
println!;
println!;
println!;
Example commands:
cargo run --example diagnosticscargo run --example diagnostics -- --jsoncargo run --example diagnostics -- --ipv4-onlycargo run --example diagnostics -- --ipv6-onlycargo run --example diagnostics -- --timeout-ms 1000cargo run --example diagnostics -- --ipv4-group 239.1.1.250 --ipv6-group ff02::114
Exit codes:
0: selected probes succeeded2: selected probes did not succeed
Testing
cargo testcargo test --examplescargo test --doc