pub fn wait_readable(socket: &UdpSocket, timeout: Duration) -> Result<bool>Expand description
Wait up to timeout for socket to have a datagram — or a pending error
— to read. Ok(false) when the time ran out.
For a receive loop that must also wake on a timer: wait here, then read
the socket non-blocking. A receive timeout (SO_RCVTIMEO) does the same
in one call, but Windows documents the socket’s state as indeterminate
once a receive has timed out, and a datagram arriving as the timeout
fires can be lost — which a stream that times out every 5 ms meets often
enough to drop a frame now and then.