fixed things
This commit is contained in:
parent
fa4cfcd7b8
commit
237e4534bf
1 changed files with 3 additions and 9 deletions
12
src/main.rs
12
src/main.rs
|
@ -327,17 +327,11 @@ fn main() {
|
|||
let bind_address = format!("0.0.0.0:12345");
|
||||
let socket = Socket::new(Domain::IPV4, Type::DGRAM, None).unwrap();
|
||||
socket.set_reuse_address(true).unwrap();
|
||||
socket.set_nonblocking(true).unwrap();
|
||||
//socket.set_nonblocking(true).unwrap();
|
||||
socket.join_multicast_v4(&Ipv4Addr::new(239, 1, 1, 1), &Ipv4Addr::new(0, 0, 0, 0)).unwrap();
|
||||
socket.bind(&"0.0.0.0:12345".parse::<SocketAddr>().unwrap().into()).unwrap();
|
||||
socket.bind(&"0.0.0.0:1234".parse::<SocketAddr>().unwrap().into()).unwrap();
|
||||
// Bind the UDP socket to the specified address and port.
|
||||
let socket = match UdpSocket::bind(&bind_address) {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
eprintln!("Error: Could not bind to address {}: {}", bind_address, e);
|
||||
panic!("aaaa");
|
||||
}
|
||||
};
|
||||
let socket: UdpSocket = socket.into();
|
||||
|
||||
println!("Listening for UDP packets on {}", bind_address);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue