summaryrefslogtreecommitdiffstats
path: root/Doc/library/asyncio-protocol.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-01-23 10:02:09 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-01-23 10:02:09 (GMT)
commitc8ea81330c5d2e8385a7fa45d83c9cccb5ba28f1 (patch)
tree6efdcc5f3d66ba2ed4ee41cde59d9da507c2f88f /Doc/library/asyncio-protocol.rst
parent7235c050851404febaba1124b2fd4d31a742f375 (diff)
downloadcpython-c8ea81330c5d2e8385a7fa45d83c9cccb5ba28f1.zip
cpython-c8ea81330c5d2e8385a7fa45d83c9cccb5ba28f1.tar.gz
cpython-c8ea81330c5d2e8385a7fa45d83c9cccb5ba28f1.tar.bz2
asyncio doc: link create_connection() to open_connection() and create_server()
to start_server() Rename also the "Network functions" section to "Stream functions" and move it to the Stream section.
Diffstat (limited to 'Doc/library/asyncio-protocol.rst')
-rw-r--r--Doc/library/asyncio-protocol.rst106
1 files changed, 53 insertions, 53 deletions
diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst
index 6a63753..aee0114 100644
--- a/Doc/library/asyncio-protocol.rst
+++ b/Doc/library/asyncio-protocol.rst
@@ -231,6 +231,59 @@ BaseSubprocessTransport
Streams
=======
+Stream functions
+----------------
+
+.. function:: open_connection(host=None, port=None, *, loop=None, limit=_DEFAULT_LIMIT, **kwds)
+
+ A wrapper for :meth:`~BaseEventLoop.create_connection()` returning a (reader,
+ writer) pair.
+
+ The reader returned is a :class:`StreamReader` instance; the writer is
+ a :class:`StreamWriter` instance.
+
+ The arguments are all the usual arguments to
+ :meth:`BaseEventLoop.create_connection` except *protocol_factory*; most
+ 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`).
+
+ (If you want to customize the :class:`StreamReader` and/or
+ :class:`StreamReaderProtocol` classes, just copy the code -- there's really
+ nothing special here except some convenience.)
+
+ This function returns a :ref:`coroutine object <coroutine>`.
+
+.. function:: start_server(client_connected_cb, host=None, port=None, *, loop=None, limit=_DEFAULT_LIMIT, **kwds)
+
+ Start a socket server, call back for each client connected.
+
+ The first parameter, *client_connected_cb*, takes 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 converted into a :class:`Task`.
+
+ 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()`.
+
+ 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 returns a :ref:`coroutine object <coroutine>`.
+
+
StreamReader
------------
@@ -572,59 +625,6 @@ Server
Coroutine to wait until service is closed.
-Network functions
-=================
-
-.. function:: open_connection(host=None, port=None, *, loop=None, limit=_DEFAULT_LIMIT, **kwds)
-
- A wrapper for :meth:`~BaseEventLoop.create_connection()` returning a (reader,
- writer) pair.
-
- The reader returned is a :class:`StreamReader` instance; the writer is
- a :class:`StreamWriter` instance.
-
- The arguments are all the usual arguments to
- :meth:`BaseEventLoop.create_connection` except *protocol_factory*; most
- 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`).
-
- (If you want to customize the :class:`StreamReader` and/or
- :class:`StreamReaderProtocol` classes, just copy the code -- there's really
- nothing special here except some convenience.)
-
- This function returns a :ref:`coroutine object <coroutine>`.
-
-.. function:: start_server(client_connected_cb, host=None, port=None, *, loop=None, limit=_DEFAULT_LIMIT, **kwds)
-
- Start a socket server, call back for each client connected.
-
- The first parameter, *client_connected_cb*, takes 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 converted into a :class:`Task`.
-
- 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()`.
-
- 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 returns a :ref:`coroutine object <coroutine>`.
-
-
Protocol example: TCP echo server and client
============================================