Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c1567df

Browse files
committed
asyncio doc: document missing event loop methods
1 parent ffbe3c6 commit c1567df

1 file changed

Lines changed: 86 additions & 4 deletions

File tree

Doc/library/asyncio-eventloop.rst

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,98 @@ Creating listening connections
272272

273273

274274

275-
Resolve name
276-
------------
275+
Watch file descriptors
276+
----------------------
277+
278+
.. method:: BaseEventLoop.add_reader(fd, callback, \*args)
279+
280+
Start watching the file descriptor for read availability and then call the
281+
*callback* with specified arguments.
282+
283+
.. method:: BaseEventLoop.remove_reader(fd)
284+
285+
Stop watching the file descriptor for read availability.
286+
287+
.. method:: BaseEventLoop.add_writer(fd, callback, \*args)
288+
289+
Start watching the file descriptor for write availability and then call the
290+
*callback* with specified arguments.
291+
292+
.. method:: BaseEventLoop.remove_writer(fd)
293+
294+
Stop watching the file descriptor for write availability.
295+
296+
297+
Low-level socket operations
298+
---------------------------
299+
300+
.. method:: BaseEventLoop.sock_recv(sock, nbytes)
301+
302+
Receive data from the socket. The return value is a bytes object
303+
representing the data received. The maximum amount of data to be received
304+
at once is specified by *nbytes*.
305+
306+
This method returns a :ref:`coroutine object <coroutine>`.
307+
308+
.. seealso::
309+
310+
The :meth:`socket.socket.recv` method.
311+
312+
.. method:: BaseEventLoop.sock_sendall(sock, data)
313+
314+
Send data to the socket. The socket must be connected to a remote socket.
315+
This method continues to send data from *data* until either all data has
316+
been sent or an error occurs. ``None`` is returned on success. On error,
317+
an exception is raised, and there is no way to determine how much data, if
318+
any, was successfully sent.
319+
320+
This method returns a :ref:`coroutine object <coroutine>`.
321+
322+
.. seealso::
323+
324+
The :meth:`socket.socket.sendall` method.
325+
326+
.. method:: BaseEventLoop.sock_connect(sock, address)
327+
328+
Connect to a remote socket at *address*.
329+
330+
This method returns a :ref:`coroutine object <coroutine>`.
331+
332+
.. seealso::
333+
334+
The :meth:`BaseEventLoop.create_connection` method, the
335+
:func:`open_connection` function and the :meth:`socket.socket.connect`
336+
method.
337+
338+
339+
.. method:: BaseEventLoop.sock_accept(sock)
340+
341+
Accept a connection. The socket must be bound to an address and listening
342+
for connections. The return value is a pair ``(conn, address)`` where *conn*
343+
is a *new* socket object usable to send and receive data on the connection,
344+
and *address* is the address bound to the socket on the other end of the
345+
connection.
346+
347+
This method returns a :ref:`coroutine object <coroutine>`.
348+
349+
.. seealso::
350+
351+
The :meth:`BaseEventLoop.create_server` method, the :func:`start_server`
352+
function and the :meth:`socket.socket.accept` method.
353+
354+
355+
Resolve host name
356+
-----------------
277357

278358
.. method:: BaseEventLoop.getaddrinfo(host, port, \*, family=0, type=0, proto=0, flags=0)
279359

280-
XXX
360+
Similar to the :meth:`socket.getaddrinfo` function, but return a
361+
:ref:`coroutine object <coroutine>`.
281362

282363
.. method:: BaseEventLoop.getnameinfo(sockaddr, flags=0)
283364

284-
XXX
365+
Similar to the :meth:`socket.getnameinfo` function, but return a
366+
:ref:`coroutine object <coroutine>`.
285367

286368

287369
Running subprocesses

0 commit comments

Comments
 (0)