Skip to content

Commit ba92063

Browse files
projectgusdpgeorge
authored andcommitted
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>
1 parent d23fb86 commit ba92063

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

docs/library/socket.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,22 +227,28 @@ Methods
227227
has the same "no short writes" policy for blocking sockets, and will return
228228
number of bytes sent on non-blocking sockets.
229229

230-
.. method:: socket.recv(bufsize)
230+
.. method:: socket.recv(bufsize, [flags])
231231

232232
Receive data from the socket. The return value is a bytes object representing the data
233233
received. The maximum amount of data to be received at once is specified by bufsize.
234234

235+
Most ports support the optional *flags* argument. Available *flags* are defined as constants
236+
in the socket module and have the same meaning as in CPython. ``MSG_PEEK`` and ``MSG_DONTWAIT``
237+
are supported on all ports which accept the *flags* argument.
238+
235239
.. method:: socket.sendto(bytes, address)
236240

237241
Send data to the socket. The socket should not be connected to a remote socket, since the
238242
destination socket is specified by *address*.
239243

240-
.. method:: socket.recvfrom(bufsize)
244+
.. method:: socket.recvfrom(bufsize, [flags])
241245

242246
Receive data from the socket. The return value is a pair *(bytes, address)* where *bytes* is a
243247
bytes object representing the data received and *address* is the address of the socket sending
244248
the data.
245249

250+
See the `recv` function for an explanation of the optional *flags* argument.
251+
246252
.. method:: socket.setsockopt(level, optname, value)
247253

248254
Set the value of the given socket option. The needed symbolic constants are defined in the

0 commit comments

Comments
 (0)