sockets - recv with time out

Steve Holden sholden at holdenweb.com
Fri Jan 11 09:14:50 EST 2002


"David Bolen" <db3l at fitlinxx.com> wrote in message
news:uy9j5a0ds.fsf at ctwd0143.fitlinxx.com...
> westernsam at hotmail.com (sam) writes:
>
> >                            I know generally this should be handled
> > better, but seeing as am working with what I'm given is there a way I
> > can do a recv with a timeout (to throw an exception, when the timeout
> > is reached)? Is this something that can be achieved with non-blocking
> > sockets and if so how?
>
> Typically you'd select() on the socket before doing the recv() - the
> select() can have a timeout.  Shouldn't be any particular need for
> non-blocking sockets.
>
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.

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list