[Python-ideas] socket.sendall() "counter" parameter

Giampaolo Rodola' g.rodola at gmail.com
Fri Apr 18 14:45:28 CEST 2014


On Fri, Apr 18, 2014 at 2:35 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Fri, 18 Apr 2014 14:28:22 +0200
> "Giampaolo Rodola'" <g.rodola at gmail.com>
> wrote:
> >
> > 2 - in case of error set a "sent" attribute to the returned
> (socket.error)
> > exception.
>
> If you want to write the logic to re-send the remaining data on error,
> why not also write the logic to use send() and re-send the remaining
> data on success? AFAICT, it's the same logic.
>
> Regards
>
> Antoine.
>

Tipically in case of error on sendall() you don't want to resend anything
because most of the times it's a disconnection error (and never, say, a
"retry" error such as EAGAIN).
The use case I'm thinking about, and which would probably be the most
common one, is to figure out how much data was sent (via exc.sent or
something), add it to "total", reconnect and resume the transfer from where
you left.

-- 
Giampaolo - http://grodola.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140418/d4cb8d86/attachment.html>


More information about the Python-ideas mailing list