diff options
author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2024-12-12 15:24:05 +0530 |
---|---|---|
committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2024-12-12 15:24:05 +0530 |
commit | 96b10b2d6ee92e884fa34924358f158c55afb101 (patch) | |
tree | 610a48262b2ed278dac5e371f10eb2c98af9b9bf | |
parent | 474e2a394638b8bf0dddc43ad8e808bd8c04d8a1 (diff) |
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index bc1e6a8..ed61942 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use socket2::{Domain, Protocol, Socket, Type}; +use std::net::Ipv4Addr; struct Init; struct Master; @@ -41,8 +42,16 @@ fn run() { fn main() { let res = Socket::new(Domain::IPV4, Type::RAW, Some(Protocol::from(112))); - let Ok(_sock) = res else { + let Ok(sock) = res else { eprintln!("Socket::new(): {}", res.err().unwrap()); std::process::exit(1); }; + let res = sock.join_multicast_v4( + &Ipv4Addr::new(224, 0, 0, 18), + &Ipv4Addr::UNSPECIFIED, + ); + let Ok(_) = res else { + eprintln!("join_multicast_v4(): {}", res.err().unwrap()); + std::process::exit(1); + }; } |