diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-11 21:47:40 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-11 21:47:40 (GMT) |
commit | 8ebeb03740dad4d9edd65de88f82840a05070941 (patch) | |
tree | 6c77cc790d68d27fc85d41ed41991271db2d4ea1 /Doc/library/asyncio-stream.rst | |
parent | b28dbac86d3c8ccde7d16c4f2de471eb53a6bffe (diff) | |
download | cpython-8ebeb03740dad4d9edd65de88f82840a05070941.zip cpython-8ebeb03740dad4d9edd65de88f82840a05070941.tar.gz cpython-8ebeb03740dad4d9edd65de88f82840a05070941.tar.bz2 |
asyncio: improve the documentation of servers
- Fix the documentation of Server.close(): it closes sockets
- Replace AbstractServer with Server
- Document Server.sockets attribute
Diffstat (limited to 'Doc/library/asyncio-stream.rst')
-rw-r--r-- | Doc/library/asyncio-stream.rst | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst index f6b126d..81bd7f0 100644 --- a/Doc/library/asyncio-stream.rst +++ b/Doc/library/asyncio-stream.rst @@ -34,29 +34,26 @@ Stream functions .. function:: start_server(client_connected_cb, host=None, port=None, \*, loop=None, limit=None, **kwds) - Start a socket server, with a callback for each client connected. + Start a socket server, with a callback for each client connected. The return + value is the same as :meth:`~BaseEventLoop.create_server()`. - The first parameter, *client_connected_cb*, takes two parameters: + The *client_connected_cb* parameter is called with two parameters: *client_reader*, *client_writer*. *client_reader* is a :class:`StreamReader` object, while *client_writer* is a - :class:`StreamWriter` object. This parameter can either be a plain callback - function or a :ref:`coroutine function <coroutine>`; if it is a coroutine - function, it will be automatically wrapped in a future using the - :meth:`BaseEventLoop.create_task` method. + :class:`StreamWriter` object. The *client_connected_cb* parameter can + either be a plain callback function or a :ref:`coroutine function + <coroutine>`; if it is a coroutine function, it will be automatically + wrapped in a future using the :meth:`BaseEventLoop.create_task` method. The rest of the arguments are all the usual arguments to :meth:`~BaseEventLoop.create_server()` except *protocol_factory*; most - common are positional host and port, with various optional keyword arguments - following. The return value is the same as - :meth:`~BaseEventLoop.create_server()`. + common are positional *host* and *port*, with various optional keyword + arguments following. Additional optional keyword arguments are *loop* (to set the event loop instance to use) and *limit* (to set the buffer limit passed to the :class:`StreamReader`). - The return value is the same as :meth:`~BaseEventLoop.create_server()`, i.e. - a :class:`AbstractServer` object which can be used to stop the service. - This function is a :ref:`coroutine <coroutine>`. .. function:: open_unix_connection(path=None, \*, loop=None, limit=None, **kwds) |