ok now crash if addr in use
parent
14d06e004b
commit
3a6633483a
|
|
@ -118,12 +118,7 @@ impl InputEngine for InputEngineUDP {
|
||||||
let addr = "0.0.0.0:".to_string() + &self.port.to_string();
|
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());
|
println!("$ echo -n 'hello world' | nc -4u -w0 localhost {}", &self.port.to_string());
|
||||||
if self.last_socket.is_none() {
|
if self.last_socket.is_none() {
|
||||||
let result = std::net::UdpSocket::bind(&addr);
|
self.last_socket = Some(std::net::UdpSocket::bind(&addr).unwrap());
|
||||||
if result.is_err() {
|
|
||||||
println!("InputEngineUDP: failed to bind to {}: {:?}", &addr, result.err());
|
|
||||||
return Vec::<char>::new();
|
|
||||||
}
|
|
||||||
self.last_socket = Some(result.unwrap());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut buf = [0; 128];
|
let mut buf = [0; 128];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue