timeoutsocket & sendall / Python 2.1

Dave Brueck dave at pythonapocrypha.com
Tue Nov 19 15:13:34 EST 2002


On 19 Nov 2002, John J Lee wrote:

> Surely somebody out there knows if this is correct?
> 
> Does nobody use timeoutsocket any more?  If not, what do you use?
> 
> Thanks for any help
> 
> "John J Lee" <jjl at pobox.com> wrote in message news:<mailman.1037399909.22831.python-list at python.org>...
> > It seems that Python 2.1 added a sendall method to socket objects.  I
> > think something like this needs adding to timeoutsocket.py:
> [...]
> > +   def sendall(self, data, flags=0):
> > +       while data:
> > +           n = self.send(data, flags)
> > +           data = data[n:]
> > +   # end sendall
> [...]
> > I've never used sockets directly, so apologies if this is broken /
> > hopelessly naive.
> > 
> > I'm surprised that nobody has bumped into this before, which is
> > why I'm posting it here -- I have a feeling I must be missing
> > something.

(not sure where to place my response in the message body - the top-post 
reply to yourself confuses me. :) )

Hi John,

Yeah, it looks like timeoutsocket should get a sendall wrapper too - why 
don't you submit a patch to the module's author. 

Perhaps the reason that nobody has raised this concern has to do with the
facts that sendall is relatively new, lots of socket code is non-blocking
(and thus wouldn't use timeoutsocket), and in Python 2.3 sockets have
timeout functionality built in?

Have fun,
-Dave





More information about the Python-list mailing list