Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does SO_RCVTIMEO affect accept()?

Tags:

c

posix

sockets

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

like image 754
R.. GitHub STOP HELPING ICE Avatar asked May 11 '11 17:05

R.. GitHub STOP HELPING ICE


1 Answers

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().

like image 175
ninjalj Avatar answered Sep 20 '22 02:09

ninjalj