i got some legacy code using: nonblocking socket, select for timeout, read(2) and write(2). Now it occasionally failed due to select/1024 fd limits. so i need to replace the select.
It seems RCVTIMEO and SNDTIMEO can also check timeout but they work for blocking mode, and it impacts too much to change from non-blocking to blocking.
So is there any other best practice to check timeout for nonblocking socket(no select)? Or i have to get some timer/nanosleep to solve this?
libev
. – Eric des Courtisselect
is actually often hard-coded (search forFD_SETSIZE
). This means that changing the system limit often isn't enough, but you have to#define FD_SETSIZE
before including<sys/select.h>
. – Some programmer dude