How can I try to read data from socket with timeout?
I know, select, pselect, poll, has a timeout field, but using of them disables \"tcp fast-path\" in tcp reno stack.
Install a handler for SIGALRM, then use alarm() or ualarm() before a regular blocking recv(). If the alarm goes off, the recv() will return an error with errno set to EINTR.