diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-eventloop.rst | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 4fbbcd8..e63180b 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -701,6 +701,36 @@ Low-level socket operations :meth:`AbstractEventLoop.create_server` and :func:`start_server`. +.. coroutinemethod:: AbstractEventLoop.sock_sendfile(sock, file, \ + offset=0, count=None, \ + *, fallback=True) + + Send a file using high-performance :mod:`os.sendfile` if possible + and return the total number of bytes which were sent. + + Asynchronous version of :meth:`socket.socket.sendfile`. + + *sock* must be non-blocking :class:`~socket.socket` of + :const:`socket.SOCK_STREAM` type. + + *file* must be a regular file object opened in binary mode. + + *offset* tells from where to start reading the file. If specified, + *count* is the total number of bytes to transmit as opposed to + sending the file until EOF is reached. File position is updated on + return or also in case of error in which case :meth:`file.tell() + <io.IOBase.tell>` can be used to figure out the number of bytes + which were sent. + + *fallback* set to ``True`` makes asyncio to manually read and send + the file when the platform does not support the sendfile syscall + (e.g. Windows or SSL socket on Unix). + + Raise :exc:`RuntimeError` if the system does not support + *sendfile* syscall and *fallback* is ``False``. + + .. versionadded:: 3.7 + Resolve host name ----------------- |