ok now crash if addr in use

master
Bel LaPointe 2023-03-22 07:17:31 -06:00
parent 14d06e004b
commit 3a6633483a
1 changed files with 1 additions and 6 deletions

View File

@ -118,12 +118,7 @@ impl InputEngine for InputEngineUDP {
let addr = "0.0.0.0:".to_string() + &self.port.to_string();
println!("$ echo -n 'hello world' | nc -4u -w0 localhost {}", &self.port.to_string());
if self.last_socket.is_none() {
let result = std::net::UdpSocket::bind(&addr);
if result.is_err() {
println!("InputEngineUDP: failed to bind to {}: {:?}", &addr, result.err());
return Vec::<char>::new();
}
self.last_socket = Some(result.unwrap());
self.last_socket = Some(std::net::UdpSocket::bind(&addr).unwrap());
}
let mut buf = [0; 128];