diff options
| author | Angus Gratton <angus@redyak.com.au> | 2025-05-16 16:09:12 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-06-03 12:52:25 +1000 |
| commit | ba92063d6491753411ea0737da3eed19278964b2 (patch) | |
| tree | fa6934d740087c3332c8628f1cb4c1fd608db115 | |
| parent | d23fb869349a1525069380e5cce30ffb6bce8a8c (diff) | |
docs: Add a description of recv/recvfrom flags argument.
Implementation added for various ports in the parent commits.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
| -rw-r--r-- | docs/library/socket.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/library/socket.rst b/docs/library/socket.rst index 944e7e631..38e0aab70 100644 --- a/docs/library/socket.rst +++ b/docs/library/socket.rst @@ -227,22 +227,28 @@ Methods has the same "no short writes" policy for blocking sockets, and will return number of bytes sent on non-blocking sockets. -.. method:: socket.recv(bufsize) +.. method:: socket.recv(bufsize, [flags]) 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 bufsize. + Most ports support the optional *flags* argument. Available *flags* are defined as constants + in the socket module and have the same meaning as in CPython. ``MSG_PEEK`` and ``MSG_DONTWAIT`` + are supported on all ports which accept the *flags* argument. + .. method:: socket.sendto(bytes, address) Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by *address*. -.. method:: socket.recvfrom(bufsize) +.. method:: socket.recvfrom(bufsize, [flags]) Receive data from the socket. The return value is a pair *(bytes, address)* where *bytes* is a bytes object representing the data received and *address* is the address of the socket sending the data. + See the `recv` function for an explanation of the optional *flags* argument. + .. method:: socket.setsockopt(level, optname, value) Set the value of the given socket option. The needed symbolic constants are defined in the |
