Skip to content

Commit

Permalink
Socket
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Sep 29, 2023
1 parent 2d09bca commit e08799c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ Opening network connections

.. versionchanged:: 3.8.1
The *reuse_address* parameter is no longer supported, as using
:py:const:`~sockets.SO_REUSEADDR` poses a significant security concern for
:py:const:`~socket.SO_REUSEADDR` poses a significant security concern for
UDP. Explicitly passing ``reuse_address=True`` will raise an exception.

When multiple processes with differing UIDs assign sockets to an
Expand All @@ -616,7 +616,7 @@ Opening network connections

For supported platforms, *reuse_port* can be used as a replacement for
similar functionality. With *reuse_port*,
:py:const:`~sockets.SO_REUSEPORT` is used instead, which specifically
:py:const:`~socket.SO_REUSEPORT` is used instead, which specifically
prevents processes with differing UIDs from assigning sockets to the same
socket address.

Expand Down
18 changes: 9 additions & 9 deletions Doc/library/socket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ all modern Unix systems, Windows, MacOS, and probably additional platforms.

The Python interface is a straightforward transliteration of the Unix system
call and library interface for sockets to Python's object-oriented style: the
:func:`.socket` function returns a :dfn:`socket object` whose methods implement
:class:`.socket` function returns a :dfn:`socket object` whose methods implement
the various socket system calls. Parameter types are somewhat higher-level than
in the C interface: as with :meth:`read` and :meth:`write` operations on Python
files, buffer allocation on receive operations is automatic, and buffer length
Expand Down Expand Up @@ -348,7 +348,7 @@ Constants
AF_INET6

These constants represent the address (and protocol) families, used for the
first argument to :func:`.socket`. If the :const:`AF_UNIX` constant is not
first argument to :class:`.socket`. If the :const:`AF_UNIX` constant is not
defined then this protocol is unsupported. More constants may be available
depending on the system.

Expand All @@ -360,7 +360,7 @@ Constants
SOCK_SEQPACKET

These constants represent the socket types, used for the second argument to
:func:`.socket`. More constants may be available depending on the system.
:class:`.socket`. More constants may be available depending on the system.
(Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be generally
useful.)

Expand Down Expand Up @@ -763,7 +763,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.

Build a pair of connected socket objects using the given address family, socket
type, and protocol number. Address family, socket type, and protocol number are
as for the :func:`.socket` function above. The default family is :const:`AF_UNIX`
as for the :class:`.socket` function above. The default family is :const:`AF_UNIX`
if defined on the platform; otherwise, the default is :const:`AF_INET`.

The newly created sockets are :ref:`non-inheritable <fd_inheritance>`.
Expand Down Expand Up @@ -859,7 +859,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.

Duplicate the file descriptor *fd* (an integer as returned by a file object's
:meth:`fileno` method) and build a socket object from the result. Address
family, socket type and protocol number are as for the :func:`.socket` function
family, socket type and protocol number are as for the :class:`.socket` function
above. The file descriptor should refer to a socket, but this is not checked ---
subsequent operations on the object may fail if the file descriptor is invalid.
This function is rarely needed, but can be used to get or set socket options on
Expand Down Expand Up @@ -924,7 +924,7 @@ The :mod:`socket` module also offers various network-related services:
``(family, type, proto, canonname, sockaddr)``

In these tuples, *family*, *type*, *proto* are all integers and are
meant to be passed to the :func:`.socket` function. *canonname* will be
meant to be passed to the :class:`.socket` function. *canonname* will be
a string representing the canonical name of the *host* if
:const:`AI_CANONNAME` is part of the *flags* argument; else *canonname*
will be empty. *sockaddr* is a tuple describing a socket address, whose
Expand Down Expand Up @@ -1040,7 +1040,7 @@ The :mod:`socket` module also offers various network-related services:
.. function:: getprotobyname(protocolname)

Translate an internet protocol name (for example, ``'icmp'``) to a constant
suitable for passing as the (optional) third argument to the :func:`.socket`
suitable for passing as the (optional) third argument to the :class:`.socket`
function. This is usually only needed for sockets opened in "raw" mode
(:const:`SOCK_RAW`); for the normal socket modes, the correct protocol is chosen
automatically if the protocol is omitted or zero.
Expand Down Expand Up @@ -2057,10 +2057,10 @@ Example

Here are four minimal example programs using the TCP/IP protocol: a server that
echoes all data that it receives back (servicing only one client), and a client
using it. Note that a server must perform the sequence :func:`.socket`,
using it. Note that a server must perform the sequence :class:`.socket`,
:meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` (possibly
repeating the :meth:`~socket.accept` to service more than one client), while a
client only needs the sequence :func:`.socket`, :meth:`~socket.connect`. Also
client only needs the sequence :class:`.socket`, :meth:`~socket.connect`. Also
note that the server does not :meth:`~socket.sendall`/:meth:`~socket.recv` on
the socket it is listening on but on the new socket returned by
:meth:`~socket.accept`.
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/2.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@ Port-Specific Changes: FreeBSD
-----------------------------------

* FreeBSD 7.1's :const:`SO_SETFIB` constant, used with
:func:`~socket.getsockopt`/:func:`~socket.setsockopt` to select an
:func:`~socket.socket.getsockopt`/:func:`~socket.socket.setsockopt` to select an
alternate routing table, is now available in the :mod:`socket`
module. (Added by Kyle VanderBeek; :issue:`8235`.)

Expand Down

0 comments on commit e08799c

Please sign in to comment.