mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-46805: Add low level UDP socket functions to asyncio (GH-31455)
This commit is contained in:
parent
7e473e94a5
commit
9f04ee569c
12 changed files with 489 additions and 7 deletions
|
@ -922,6 +922,29 @@ convenient.
|
|||
|
||||
.. versionadded:: 3.7
|
||||
|
||||
.. coroutinemethod:: loop.sock_recvfrom(sock, bufsize)
|
||||
|
||||
Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of
|
||||
:meth:`socket.recvfrom() <socket.socket.recvfrom>`.
|
||||
|
||||
Return a tuple of (received data, remote address).
|
||||
|
||||
*sock* must be a non-blocking socket.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
.. coroutinemethod:: loop.sock_recvfrom_into(sock, buf, nbytes=0)
|
||||
|
||||
Receive a datagram of up to *nbytes* from *sock* into *buf*.
|
||||
Asynchronous version of
|
||||
:meth:`socket.recvfrom_into() <socket.socket.recvfrom_into>`.
|
||||
|
||||
Return a tuple of (number of bytes received, remote address).
|
||||
|
||||
*sock* must be a non-blocking socket.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
.. coroutinemethod:: loop.sock_sendall(sock, data)
|
||||
|
||||
Send *data* to the *sock* socket. Asynchronous version of
|
||||
|
@ -940,6 +963,18 @@ convenient.
|
|||
method, before Python 3.7 it returned a :class:`Future`.
|
||||
Since Python 3.7, this is an ``async def`` method.
|
||||
|
||||
.. coroutinemethod:: loop.sock_sendto(sock, data, address)
|
||||
|
||||
Send a datagram from *sock* to *address*.
|
||||
Asynchronous version of
|
||||
:meth:`socket.sendto() <socket.socket.sendto>`.
|
||||
|
||||
Return the number of bytes sent.
|
||||
|
||||
*sock* must be a non-blocking socket.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
.. coroutinemethod:: loop.sock_connect(sock, address)
|
||||
|
||||
Connect *sock* to a remote socket at *address*.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue