2007/10/30, Francis Cianfrocca <garbagecat10 / gmail.com>:

> We know nothing about the protocol that the OP is using (because he hasn't
> told us yet). It may not be realistic for the client to have an expectation
> about how much data the server will send. #select may turn out to be the
> best choice.

Quoting from the original posting:

> Now my problem is that "data = socket.recv(size)"
> seems to behave non-blocking for some reason. It does not wait for the 10
> seconds but rather executes immediately and "data" remains empty. When I add
> "sleep(10)" before, it works...

So it seems pretty clear that he knows how many bytes to expect. In
which case I'd use #read because the code will be simpler than with
#select.

> #read with no parameters works if the server closes the connection after
> sending. But as a general rule, that's a bad server design (ideally, the
> client should close the connection, for reasons relating to the TIME_WAIT
> state).

Agreed: the client should establish and close a connection.

Kind regards

robert