[cs631apue] Socket Timeout

Jan Schaumann jschauma at stevens.edu
Thu Nov 15 20:22:29 EST 2018


Keyur M Ved <kved at stevens.edu> wrote:
 
> I am using the example you provided in class for setting a time out on
> a socket using the last argument, but even when reducing the timeout
> to 10 seconds the client still seems to be blocked on the read(2)
> call. Do I need to set a timeout around the read call as well?

Hard to say without any code to look at.

If you're using select(2), then the timeout affects the select(2) call
itself; once select(2) returns, the FDs in question are ready for the
I/O specified.  However, you might still block if, for example, you're
trying to read more data than is available.

-Jan


More information about the cs631apue mailing list