[Python-checkins] cpython: asyncio doc: document missing event loop methods

victor.stinner python-checkins at python.org
Sat Feb 8 23:23:28 CET 2014


http://hg.python.org/cpython/rev/a4030dd01456
changeset:   89064:a4030dd01456
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Feb 08 23:22:58 2014 +0100
summary:
  asyncio doc: document missing event loop methods

files:
  Doc/library/asyncio-eventloop.rst |  90 ++++++++++++++++++-
  1 files changed, 86 insertions(+), 4 deletions(-)


diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -272,16 +272,98 @@
 
 
 
-Resolve name
-------------
+Watch file descriptors
+----------------------
+
+.. method:: BaseEventLoop.add_reader(fd, callback, \*args)
+
+   Start watching the file descriptor for read availability and then call the
+   *callback* with specified arguments.
+
+.. method:: BaseEventLoop.remove_reader(fd)
+
+   Stop watching the file descriptor for read availability.
+
+.. method:: BaseEventLoop.add_writer(fd, callback, \*args)
+
+   Start watching the file descriptor for write availability and then call the
+   *callback* with specified arguments.
+
+.. method:: BaseEventLoop.remove_writer(fd)
+
+   Stop watching the file descriptor for write availability.
+
+
+Low-level socket operations
+---------------------------
+
+.. method:: BaseEventLoop.sock_recv(sock, nbytes)
+
+   Receive data from the socket.  The return value is a bytes object
+   representing the data received.  The maximum amount of data to be received
+   at once is specified by *nbytes*.
+
+   This method returns a :ref:`coroutine object <coroutine>`.
+
+   .. seealso::
+
+      The :meth:`socket.socket.recv` method.
+
+.. method:: BaseEventLoop.sock_sendall(sock, data)
+
+   Send data to the socket.  The socket must be connected to a remote socket.
+   This method continues to send data from *data* until either all data has
+   been sent or an error occurs.  ``None`` is returned on success.  On error,
+   an exception is raised, and there is no way to determine how much data, if
+   any, was successfully sent.
+
+   This method returns a :ref:`coroutine object <coroutine>`.
+
+   .. seealso::
+
+      The :meth:`socket.socket.sendall` method.
+
+.. method:: BaseEventLoop.sock_connect(sock, address)
+
+   Connect to a remote socket at *address*.
+
+   This method returns a :ref:`coroutine object <coroutine>`.
+
+   .. seealso::
+
+      The :meth:`BaseEventLoop.create_connection` method, the
+      :func:`open_connection` function and the :meth:`socket.socket.connect`
+      method.
+
+
+.. method:: BaseEventLoop.sock_accept(sock)
+
+   Accept a connection. The socket must be bound to an address and listening
+   for connections. The return value is a pair ``(conn, address)`` where *conn*
+   is a *new* socket object usable to send and receive data on the connection,
+   and *address* is the address bound to the socket on the other end of the
+   connection.
+
+   This method returns a :ref:`coroutine object <coroutine>`.
+
+   .. seealso::
+
+      The :meth:`BaseEventLoop.create_server` method, the :func:`start_server`
+      function and the :meth:`socket.socket.accept` method.
+
+
+Resolve host name
+-----------------
 
 .. method:: BaseEventLoop.getaddrinfo(host, port, \*, family=0, type=0, proto=0, flags=0)
 
-   XXX
+   Similar to the :meth:`socket.getaddrinfo`  function, but return a
+   :ref:`coroutine object <coroutine>`.
 
 .. method:: BaseEventLoop.getnameinfo(sockaddr, flags=0)
 
-   XXX
+   Similar to the :meth:`socket.getnameinfo`  function, but return a
+   :ref:`coroutine object <coroutine>`.
 
 
 Running subprocesses

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list