Search code examples
csocketsposix

Does SO_RCVTIMEO affect accept()?


Does the SO_RCVTIMEO option affect accept (causing it to return EAGAIN or EWOULDBLOCK if the timeout expires)? Is there any behavior specified by the standard? I can't find it in the documentation for accept or use of options:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_10_16


Solution

  • While on POSIX SO_RCVTIMEO is defined for "an input function", and SO_SNDTIMEO is defined for "an output function", I can'r find any definition for "input function" or "output function", so I'll just say they are read/receive and write/send at least.

    In the specific case of Linux, SO_RCVTIMEO affects accept(), as can be seen by looking at inet_csk_accept(), and SO_SND_TIMEO affects connect(), as can be seen by looking at tcp_sendmsg().