Sockets and time-outs

Aahz Maruch aahz at netcom.com
Mon Aug 14 13:38:22 EDT 2000


In article <031501c005fb$b48ec700$978647c1 at DEVELOPMENT>,
Ulf Engstrøm  <ulf.engstrom at b2b-link.com> wrote:
>
>I'm using the socket module for a program, but there's one thing that I want
>to improve on it.
>The client side of this sends data to the server and always get a reply
>back, but sometimes the server sends something that wasn't requested of the
>reply comes in two sends. Thus I need to read the socket sometimes to see if
>there's something waiting. Using recv() is great for getting a reply I know
>is there, but when using it and there's no message there it takes an awfully
>long time to time out and waiting for this time-out blocks the sending on
>the same socket. Is there any way to set a shorter time-out (basically just
>check for 2 secs or so) or is there an other function for this?

select is probably the best option in this case, but you might also take
a look at http://www.vex.net/parnassus/apyllo.py?i=87800233
--
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Gun-toting Naderite / socialized medicine libertarian



More information about the Python-list mailing list