Skip to main content

ssm/
ssm.rs

1use std::net::{IpAddr, Ipv4Addr, SocketAddr};
2
3use tokio_multicast::MulticastSocket;
4
5#[tokio::main(flavor = "current_thread")]
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7    // Placeholder example for the future source-specific multicast path.
8    let result = MulticastSocket::builder()
9        .bind(SocketAddr::from((Ipv4Addr::UNSPECIFIED, 5000)))
10        .join_source(
11            IpAddr::V4(Ipv4Addr::new(232, 1, 1, 1)),
12            IpAddr::V4(Ipv4Addr::new(192, 168, 1, 10)),
13        )
14        .build()
15        .await;
16
17    match result {
18        Ok(_) => println!("source-specific multicast socket created"),
19        Err(err) => println!("source-specific multicast is not implemented yet: {err}"),
20    }
21
22    Ok(())
23}