Giampaolo Rodola' added the comment: > [...] I'd like a parameter for the offset, and another one for the > number of bytes to send. > To sum up, I think there's a fundamental confusion between blocksize > and count in this API.
Ah OK, I see what you mean now. If seems we didn't understand each other. =) And yes, I suppose you're right: if possible we should pass a high value and let sendfile() do its thing. Note that we still have to implement an internal loop ourselves though because if the socket has a timeout sendfile() will return before EOF (I've checked this just now). As for what to do, here's what I propose: - we provide a blocksize argument defaulting to None - in case of send() and blocksize == None we set it to 262144 - in case of sendfile() we set it to a very high value (4M or something) - using os.path.getsize(file.name) looks risky to me as the user might have changed CWD in the meantime or something I'm -1 about adding "count" *and* "blocksize" parameters. "blocksize" alone is good enough IMO and considering what I've just described it is a better name than "count". ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17552> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com