fix: fixed weird issues with querying routes
this just involved a better understanding of the data types provided by libnl and some refactoring to make querying as a user of the libnl library easier
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use std::net::UdpSocket;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let input = UdpSocket::bind("0.0.0.0:54248")?;
|
||||
|
||||
loop {
|
||||
let mut buf = [0u8; 4];
|
||||
|
||||
let Ok((amount, src)) = input.recv_from(&mut buf[..]) else { continue; };
|
||||
|
||||
if amount != 4 {
|
||||
continue;
|
||||
}
|
||||
|
||||
println!("Received packet: {}", i32::from_be_bytes(buf));
|
||||
|
||||
let Ok(_) = input.send_to(&buf, src) else { continue; };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user