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?
poll()is essentially a drop-in replacement for usingselect(), but does not have the 1024 file descriptor limit. You will have to change your code slightly to create an array ofstruct pollfdstructures instead of usingfd_sets, but the overall structure of the code should not have to change.