O'Reilly logo
  • Ivan Zderadicka thinks this is interesting:

Since there is no way to set SO_REUSEADDR and SO_REUSEPORT in the standard library, we will need to run the client on multiple different machines and the server on another


Cover of Network Programming with Rust


I think SO_REUSEADDR is not relevant. It's just about SO_REUSEPORT. For linux it can be set wuth net2 crate: let socket = UdpBuilder::new_v4().unwrap() .reuse_port(true).unwrap() .bind((any, port)).expect("Could not bind client socket");

then I can run easily 10 clients on one machine like: for i in {0..10}; do (cargo run -- client &) ; done