diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-10-12 18:36:04 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-10-12 18:36:04 (GMT) |
commit | 33f6abe4ae7b1fa6d83e26c4dafc0210c09d2254 (patch) | |
tree | 92360117f04ea4d3a6181e9153bf4fefe2936588 /Doc | |
parent | ed051594d70fe4c6b170aee667af4e32dfe6b867 (diff) | |
download | cpython-33f6abe4ae7b1fa6d83e26c4dafc0210c09d2254.zip cpython-33f6abe4ae7b1fa6d83e26c4dafc0210c09d2254.tar.gz cpython-33f6abe4ae7b1fa6d83e26c4dafc0210c09d2254.tar.bz2 |
asyncio doc: reformat create_server() doc
Fix also the reate_unix_connection() doc: the method is not support on Windows,
not need to mention that ssl is not support with ProactorEventLoop.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-eventloop.rst | 52 | ||||
-rw-r--r-- | Doc/library/asyncio-eventloops.rst | 2 |
2 files changed, 29 insertions, 25 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 5ffbea7..800fae2 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -258,8 +258,6 @@ Creating connections establish the connection in the background. When successful, the coroutine returns a ``(transport, protocol)`` pair. - On Windows with :class:`ProactorEventLoop`, SSL/TLS is not supported. - See the :meth:`BaseEventLoop.create_connection` method for parameters. Availability: UNIX. @@ -270,35 +268,41 @@ Creating listening connections .. method:: BaseEventLoop.create_server(protocol_factory, host=None, port=None, \*, family=socket.AF_UNSPEC, flags=socket.AI_PASSIVE, sock=None, backlog=100, ssl=None, reuse_address=None) - Create a TCP server bound to *host* and *port*. Return a :class:`Server` object, - its :attr:`~Server.sockets` attribute contains created sockets. Use the - :meth:`Server.close` method to stop the server: close listening sockets. + Create a TCP server (socket type :data:`~socket.SOCK_STREAM`) bound to + *host* and *port*. - This method is a :ref:`coroutine <coroutine>`. + Return a :class:`Server` object, its :attr:`~Server.sockets` attribute + contains created sockets. Use the :meth:`Server.close` method to stop the + server: close listening sockets. - If *host* is an empty string or ``None``, all interfaces are assumed - and a list of multiple sockets will be returned (most likely - one for IPv4 and another one for IPv6). + Parameters: - *family* can be set to either :data:`socket.AF_INET` or - :data:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6. If not set - it will be determined from host (defaults to :data:`socket.AF_UNSPEC`). + * If *host* is an empty string or ``None``, all interfaces are assumed + and a list of multiple sockets will be returned (most likely + one for IPv4 and another one for IPv6). - *flags* is a bitmask for :meth:`getaddrinfo`. + * *family* can be set to either :data:`socket.AF_INET` or + :data:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6. If not set + it will be determined from host (defaults to :data:`socket.AF_UNSPEC`). - *sock* can optionally be specified in order to use a preexisting - socket object. + * *flags* is a bitmask for :meth:`getaddrinfo`. - *backlog* is the maximum number of queued connections passed to - :meth:`~socket.socket.listen` (defaults to 100). + * *sock* can optionally be specified in order to use a preexisting + socket object. If specified, *host* and *port* should be omitted (must be + :const:`None`). - *ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the - accepted connections. + * *backlog* is the maximum number of queued connections passed to + :meth:`~socket.socket.listen` (defaults to 100). - *reuse_address* tells the kernel to reuse a local socket in - TIME_WAIT state, without waiting for its natural timeout to - expire. If not specified will automatically be set to True on - UNIX. + * *ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the + accepted connections. + + * *reuse_address* tells the kernel to reuse a local socket in + TIME_WAIT state, without waiting for its natural timeout to + expire. If not specified will automatically be set to True on + UNIX. + + This method is a :ref:`coroutine <coroutine>`. On Windows with :class:`ProactorEventLoop`, SSL/TLS is not supported. @@ -462,7 +466,7 @@ Use :class:`ProactorEventLoop` to support pipes on Windows. *protocol_factory* should instantiate object with :class:`BaseProtocol` interface. *pipe* is file-like object. - Return pair (transport, protocol), where transport support + Return pair (transport, protocol), where *transport* supports :class:`WriteTransport` interface. With :class:`SelectorEventLoop` event loop, the *pipe* is set to diff --git a/Doc/library/asyncio-eventloops.rst b/Doc/library/asyncio-eventloops.rst index 282cc4b..b871083 100644 --- a/Doc/library/asyncio-eventloops.rst +++ b/Doc/library/asyncio-eventloops.rst @@ -76,7 +76,7 @@ Windows Common limits of Windows event loops: -- :meth:`~BaseEventLoop.create_unix_server` and +- :meth:`~BaseEventLoop.create_unix_connection` and :meth:`~BaseEventLoop.create_unix_server` are not supported: the socket family :data:`socket.AF_UNIX` is specific to UNIX - :meth:`~BaseEventLoop.add_signal_handler` and |