@@ -39,6 +39,8 @@ is implicit on send operations.
3939 A TLS/SSL wrapper for socket objects.
4040
4141
42+ .. _socket-addresses :
43+
4244Socket families
4345---------------
4446
@@ -900,7 +902,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
900902
901903 Build a pair of connected socket objects using the given address family, socket
902904 type, and protocol number. Address family, socket type, and protocol number are
903- as for the :func: `~socket.socket ` function above . The default family is :const: `AF_UNIX `
905+ as for the :func: `~socket.socket ` function. The default family is :const: `AF_UNIX `
904906 if defined on the platform; otherwise, the default is :const: `AF_INET `.
905907
906908 The newly created sockets are :ref: `non-inheritable <fd_inheritance >`.
@@ -996,8 +998,8 @@ The following functions all create :ref:`socket objects <socket-objects>`.
996998
997999 Duplicate the file descriptor *fd * (an integer as returned by a file object's
9981000 :meth: `~io.IOBase.fileno ` method) and build a socket object from the result. Address
999- family, socket type and protocol number are as for the :func: `~socket.socket ` function
1000- above. The file descriptor should refer to a socket, but this is not checked ---
1001+ family, socket type and protocol number are as for the :func: `~socket.socket ` function.
1002+ The file descriptor should refer to a socket, but this is not checked ---
10011003 subsequent operations on the object may fail if the file descriptor is invalid.
10021004 This function is rarely needed, but can be used to get or set socket options on
10031005 a socket passed to a program as standard input or output (such as a server
@@ -1552,8 +1554,8 @@ to sockets.
15521554
15531555.. method :: socket.bind(address)
15541556
1555- Bind the socket to *address *. The socket must not already be bound. ( The format
1556- of *address * depends on the address family --- see above.)
1557+ Bind the socket to *address *. The socket must not already be bound. The format
1558+ of *address * depends on the address family --- see :ref: ` socket-addresses `.
15571559
15581560 .. audit-event :: socket.bind self,address socket.socket.bind
15591561
@@ -1586,8 +1588,8 @@ to sockets.
15861588
15871589.. method :: socket.connect(address)
15881590
1589- Connect to a remote socket at *address *. ( The format of *address * depends on the
1590- address family --- see above.)
1591+ Connect to a remote socket at *address *. The format of *address * depends on the
1592+ address family --- see :ref: ` socket-addresses `.
15911593
15921594 If the connection is interrupted by a signal, the method waits until the
15931595 connection completes, or raises a :exc: `TimeoutError ` on timeout, if the
@@ -1662,16 +1664,16 @@ to sockets.
16621664.. method :: socket.getpeername()
16631665
16641666 Return the remote address to which the socket is connected. This is useful to
1665- find out the port number of a remote IPv4/v6 socket, for instance. ( The format
1666- of the address returned depends on the address family --- see above.) On some
1667- systems this function is not supported.
1667+ find out the port number of a remote IPv4/v6 socket, for instance. The format
1668+ of the address returned depends on the address family --- see :ref: ` socket-addresses `.
1669+ On some systems this function is not supported.
16681670
16691671
16701672.. method :: socket.getsockname()
16711673
16721674 Return the socket's own address. This is useful to find out the port number of
1673- an IPv4/v6 socket, for instance. ( The format of the address returned depends on
1674- the address family --- see above.)
1675+ an IPv4/v6 socket, for instance. The format of the address returned depends on
1676+ the address family --- see :ref: ` socket-addresses `.
16751677
16761678
16771679.. method :: socket.getsockopt(level, optname[, buflen])
@@ -1783,7 +1785,8 @@ to sockets.
17831785 where *bytes * is a bytes object representing the data received and *address * is the
17841786 address of the socket sending the data. See the Unix manual page
17851787 :manpage: `recv(2)` for the meaning of the optional argument *flags *; it defaults
1786- to zero. (The format of *address * depends on the address family --- see above.)
1788+ to zero. The format of *address * depends on the address family --- see
1789+ :ref: `socket-addresses `.
17871790
17881791 .. versionchanged :: 3.5
17891792 If the system call is interrupted and the signal handler does not raise
@@ -1913,8 +1916,8 @@ to sockets.
19131916 new bytestring. The return value is a pair ``(nbytes, address) `` where *nbytes * is
19141917 the number of bytes received and *address * is the address of the socket sending
19151918 the data. See the Unix manual page :manpage: `recv(2)` for the meaning of the
1916- optional argument *flags *; it defaults to zero. ( The format of *address *
1917- depends on the address family --- see above.)
1919+ optional argument *flags *; it defaults to zero. The format of *address *
1920+ depends on the address family --- see :ref: ` socket-addresses `.
19181921
19191922
19201923.. method :: socket.recv_into(buffer[, nbytes[, flags]])
@@ -1929,7 +1932,7 @@ to sockets.
19291932.. method :: socket.send(bytes[, flags])
19301933
19311934 Send data to the socket. The socket must be connected to a remote socket. The
1932- optional *flags * argument has the same meaning as for :meth: `recv ` above .
1935+ optional *flags * argument has the same meaning as for :meth: `recv `.
19331936 Returns the number of bytes sent. Applications are responsible for checking that
19341937 all data has been sent; if only some of the data was transmitted, the
19351938 application needs to attempt delivery of the remaining data. For further
@@ -1944,7 +1947,7 @@ to sockets.
19441947.. method :: socket.sendall(bytes[, flags])
19451948
19461949 Send data to the socket. The socket must be connected to a remote socket. The
1947- optional *flags * argument has the same meaning as for :meth: `recv ` above .
1950+ optional *flags * argument has the same meaning as for :meth: `recv `.
19481951 Unlike :meth: `send `, this method continues to send data from *bytes * until
19491952 either all data has been sent or an error occurs. ``None `` is returned on
19501953 success. On error, an exception is raised, and there is no way to determine how
@@ -1965,9 +1968,9 @@ to sockets.
19651968
19661969 Send data to the socket. The socket should not be connected to a remote socket,
19671970 since the destination socket is specified by *address *. The optional *flags *
1968- argument has the same meaning as for :meth: `recv ` above . Return the number of
1969- bytes sent. ( The format of *address * depends on the address family --- see
1970- above.)
1971+ argument has the same meaning as for :meth: `recv `. Return the number of
1972+ bytes sent. The format of *address * depends on the address family --- see
1973+ :ref: ` socket-addresses `.
19711974
19721975 .. audit-event :: socket.sendto self,address socket.socket.sendto
19731976
0 commit comments