sockets - recv with time out

David Bolen db3l at fitlinxx.com
Fri Jan 11 18:21:54 EST 2002


"Steve Holden" <sholden at holdenweb.com> 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.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list