os.sendfile(out, in, offset, count)
os.sendfile(out, in, offset, count, [headers, ][trailers, ]flags=0)
Copy count bytes from file descriptor in to file descriptor out starting at offset. Return the number of bytes sent. When EOF is reached return 0.
The first function notation is supported by all platforms that define sendfile()
.
On Linux, if offset is given as None
, the bytes are read from the current position of in and the position of in is updated.
The second case may be used on Mac OS X and FreeBSD where headers and trailers are arbitrary sequences of buffers that are written before and after the data from in is written. It returns the same as the first case.
On Mac OS X and FreeBSD, a value of 0 for count specifies to send until the end of in is reached.
All platforms support sockets as out file descriptor, and some platforms allow other types (e.g. regular file, pipe) as well.
Cross-platform applications should not use headers, trailers and flags arguments.
Availability: Unix.
Note
For a higher-level wrapper of sendfile()
, see socket.socket.sendfile()
.
New in version 3.3.
Please login to continue.