4 ms·
setsockopt [1], though, lets you change the timeout on a per-socket basis via the SO_RCVTIMEO and SO_SNDTIMEO options. If you need to know sooner that your dat
by andrewstuart2 10y ago
setsockopt [1], though, lets you change the timeout on a per-socket basis via the SO_RCVTIMEO and SO_SNDTIMEO options.
If you need to know sooner that your data isn't going to be sent, it's pretty trivial to set up a short timeout that overrides the system defaults.
[1] https://www.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 https://www.freebsd.org/cgi/man.cgi?query=setsockopt&sektion...
- caf 10y agoSO_RCVTIMEO and SO_SNDTIMEO are for setting a timeout on blocking socket operations. They don't tell you anything about whether the other end is still there or not. Setting those options isn't much different from setting a timeout in your poll() call.