I couldn't find any documentation on this except from some Python documentation
18.1.4.2. Timeouts and the accept method
If
getdefaulttimeout()
is notNone
, sockets returned by theaccept()
method inherit that timeout. Otherwise, the behaviour depends on settings of the listening socket:if the listening socket is in blocking mode or in timeout mode, the socket returned by
accept()
is in blocking mode;if the listening socket is in non-blocking mode, whether the socket returned by
accept()
is in blocking or non-blocking mode is operating system-dependent. If you want to ensure cross-platform behaviour, it is recommended you manually override this setting.
I have read this [question]: Are socket options inherited across accept() from the listening socket? , I think in the end the verdict is still implementation defined. I guess testing on the platform is easier than reading the sources from each kernel.
Here it says clearly that timeout option is inherited. But on the manpage of accept(2), there's no mention of this. I found this quite shocking when I debugged some C++ code on one of my box ( Embedded Linux box). I expected the accepted socket not to inherit this option.
Where can I find a definitive answer to this question?