[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: send with timeout socket
From:       Bryan Olson <fakeaddress () nowhere ! org>
Date:       2006-09-22 15:03:10
Message-ID: OWSQg.3522$vJ2.2897 () newssvr12 ! news ! prodigy ! com
[Download RAW message or body]

Stéphane Ninin wrote:
> Yes, I typed it *really* too fast, it would be more something like this:
>    
>     def sendall(self, data):
>         while data:
>             try:
>                 n = self.request.send(data)
>                 data = data[n:]
>             except socket.timeout, e:
>                 if self.isTerminated():
>                     return

And from a previous post:

   (self.isTerminated just checks is some event has been set
    by another thread)

Do you want to timeout on inactivity, or do you want to timeout
if sendall() does not complete within a given time?


-- 
--Bryan
-- 
http://mail.python.org/mailman/listinfo/python-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic