Skip to content

bpo-28724: Move socket.send_fds and socket.recv_fds documentation to the "Other functions" section #22608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions Doc/library/socket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,32 @@ The :mod:`socket` module also offers various network-related services:
"Interface name" is a name as documented in :func:`if_nameindex`.


.. function:: send_fds(sock, buffers, fds[, flags[, address]])

Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket *sock*.
The *fds* parameter is a sequence of file descriptors.
Consult :meth:`sendmsg` for the documentation of these parameters.

.. availability:: Unix supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` mechanism.

.. versionadded:: 3.9


.. function:: recv_fds(sock, bufsize, maxfds[, flags])

Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket *sock*.
Return ``(msg, list(fds), flags, addr)``.
Consult :meth:`recvmsg` for the documentation of these parameters.

.. availability:: Unix supporting :meth:`~socket.recvmsg` and :const:`SCM_RIGHTS` mechanism.

.. versionadded:: 3.9

.. note::

Any truncated integers at the end of the list of file descriptors.


.. _socket-objects:

Socket Objects
Expand Down Expand Up @@ -1637,29 +1663,6 @@ to sockets.

.. versionadded:: 3.6

.. method:: socket.send_fds(sock, buffers, fds[, flags[, address]])

Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket.
The *fds* parameter is a sequence of file descriptors.
Consult :meth:`sendmsg` for the documentation of these parameters.

.. availability:: Unix supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` mechanism.

.. versionadded:: 3.9

.. method:: socket.recv_fds(sock, bufsize, maxfds[, flags])

Receive up to *maxfds* file descriptors. Return ``(msg, list(fds), flags, addr)``. Consult
:meth:`recvmsg` for the documentation of these parameters.

.. availability:: Unix supporting :meth:`~socket.recvmsg` and :const:`SCM_RIGHTS` mechanism.

.. versionadded:: 3.9

.. note::

Any truncated integers at the end of the list of file descriptors.

.. method:: socket.sendfile(file, offset=0, count=None)

Send a file until EOF is reached by using high-performance
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ The socket module now supports the :data:`~socket.CAN_J1939` protocol on
platforms that support it. (Contributed by Karl Ding in :issue:`40291`.)

The socket module now has the :func:`socket.send_fds` and
:func:`socket.recv.fds` methods. (Contributed by Joannah Nanjekye, Shinya
:func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya
Okano and Victor Stinner in :issue:`28724`.)


Expand Down