sockets - recv with time out

David Bolen db3l at
Sat Jan 12 00:21:54 CET 2002

"Steve Holden" <sholden at> writes:

> Erm, how would you do a recv() when your program is blocked waiting for
> select() to return? Non-blocking sockets are an absolute necessity for this
> application, and timeoutsocket is the best solution, as Oleg has already
> said.

Others have answered the specific question, but I just also wanted to
point out that all timeoutsocket itself is doing is exactly what I
suggested - in lieu of a straight recv() it selects() and then
receives.  Although it does temporarily enable non-blocking for calls
like connect() and accept() and exports the ability for the user of
the class to set non-blocking as with standard sockets, its default is
blocking, and it works fine there too.

-- David
 \               David Bolen            \   E-mail: db3l at  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \

More information about the Python-list mailing list