Author giampaolo.rodola
Recipients asvetlov, christian.heimes, giampaolo.rodola, neologix, pitrou, rosslagerwall
Date 2013-04-08.15:14:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
New patch in attachment includes a new 'offset' parameter, new tests and also update file offset on return or in case of error so that file.tell() can be used to tell how many bytes were transmitted at any time.
This way we'll avoid using a custom exception.

In summary, the API looks like this.

Transfer ok:

>>> file = open('somefile', 'rb')
>>> s = socket.socket()
>>> sock.sendfile(file)
(True, None)
>>> file.tell()

...and in case sendfile() could not be used internally because file was not a regular file:

>>> file = io.BytesIO(b'x' * 1*1024*1024)
>>> sock.sendfile(file)
(False, UnsupportedOperation('fileno',))
>>> file.tell()

I still haven't looked into TransmitFile on Windows as I have to figure out how to compile Python 3.4 on Windows.
Date User Action Args
2013-04-08 15:14:11giampaolo.rodolasetrecipients: + giampaolo.rodola, pitrou, christian.heimes, asvetlov, neologix, rosslagerwall
2013-04-08 15:14:11giampaolo.rodolasetmessageid: <>
2013-04-08 15:14:11giampaolo.rodolalinkissue17552 messages
2013-04-08 15:14:11giampaolo.rodolacreate