From 553cc3b194df875cac8736473e1f01cf3e40a660 Mon Sep 17 00:00:00 2001 From: Trey Smith Date: Sat, 8 Jan 2022 07:21:11 -0500 Subject: [PATCH] net: document that port 0 picks a random port (#4386) --- tokio/src/net/udp.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index 68cc98239..a6d80c6f7 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -128,6 +128,10 @@ impl UdpSocket { /// This function will create a new UDP socket and attempt to bind it to /// the `addr` provided. /// + /// Binding with a port number of 0 will request that the OS assigns a port + /// to this listener. The port allocated can be queried via the `local_addr` + /// method. + /// /// # Example /// /// ```no_run