From 81370e6202859dee53c7a42053ec0ff4427910cf Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sat, 11 Apr 2026 22:06:08 +0200 Subject: [PATCH] net: add docs on `ConnectionRefused` errors with udp sockets (#7870) --- spellcheck.dic | 3 ++- tokio/src/net/udp.rs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spellcheck.dic b/spellcheck.dic index 3a7e586c0..6e162d39c 100644 --- a/spellcheck.dic +++ b/spellcheck.dic @@ -1,4 +1,4 @@ -316 +317 & + < @@ -139,6 +139,7 @@ hashmaps HashMaps hashsets HdrHistogram +ICMP ie Illumos impl diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index cc6a6b23d..af5517d34 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -531,7 +531,12 @@ impl UdpSocket { /// The [`connect`] method will connect this socket to a remote address. /// This method will fail if the socket is not connected. /// + /// This method may fail with a [`ConnectionRefused`] error if the remote + /// address has replied with ICMP Unreachable to a previously sent packet. + /// However, this behavior depends on the OS. + /// /// [`connect`]: method@Self::connect + /// [`ConnectionRefused`]: std::io::ErrorKind::ConnectionRefused /// /// # Return ///