Using .set_read_timeout on UDP socket

Ref: On windows, UdpSocket::set_read_timeout(X) waits (X + 500ms) - #4 by inetic

I want to use .set_read_timeout() with a short timeout, maybe 50-100ms, on a socket from std::net::UdpSocket. Does that work? The above note indicates it didn't work on Windows in 2015. Windows added 500ms to each timeout. Is that still a problem? Also, there are Stack Overflow discussions that indicate that setting the timeout on an active socket, after binding, is bad.

The usual approach in C++ would be to use select or poll, but those are not implemented for UdpSocket, as far as I can tell.

Use case: send a retransmission for an unacknowledged packet. This is running in a thread, and not at top level where mio or async approaches would be reasonable.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.