#[test]
fn ephemeral_port() -> Result {
let mut sim = Builder::new().build();
sim.client("client", async {
let sock = bind_to(0).await?;
// turmoil should assign a port to the ephemeral range
assert_ne!(sock.local_addr()?.port(), 0);
assert!(sock.local_addr()?.port() >= 49152);
Ok(())
});
sim.run()
}
It would be nice to support ephemeral port assignment. This is useful for clients that don't care about the specific port number; they just need a free port.
I tried the following code:
It would be nice to support ephemeral port assignment. This is useful for clients that don't care about the specific port number; they just need a free port.
From https://www.rfc-editor.org/rfc/rfc6335#section-6: