socket.rcv timeout while-loop

Dwayne Blind dwayneblind at gmail.com
Thu Feb 3 19:13:37 CET 2011


Thanks for your answer. I don't want to reset my socket. I want to apply the
timeout to the rcv method only.

What about select ?

http://docs.python.org/library/select.html#select.select

How to implement it ?

Thanks a lot,
Dwayne

2011/2/3 Stephen Hansen <me+list/python at ixokai.io>

> On 2/3/11 9:56 AM, Dwayne Blind wrote:
> > However I would like to set timeout on the socket rcv method, so that
> > the while loop stops exactly after 3 seconds. Is this possible ?
>
> I rarely do low-level socket stuff -- but I think s.settimeout() is what
> you're looking for. It applies to the whole socket, and not just one
> method -- so you may want to reset it after you're done recv'n.
>
> --
>
>   Stephen Hansen
>   ... Also: Ixokai
>   ... Mail: me+list/python (AT) ixokai (DOT) io
>   ... Blog: http://meh.ixokai.io/
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110203/259c726e/attachment.html>


More information about the Python-list mailing list