@@ -23,7 +23,7 @@ all modern Unix systems, Windows, MacOS, and probably additional platforms.
23
23
24
24
The Python interface is a straightforward transliteration of the Unix system
25
25
call and library interface for sockets to Python's object-oriented style: the
26
- :func: `.socket ` function returns a :dfn: `socket object ` whose methods implement
26
+ :func: `~socket .socket ` function returns a :dfn: `socket object ` whose methods implement
27
27
the various socket system calls. Parameter types are somewhat higher-level than
28
28
in the C interface: as with :meth: `read ` and :meth: `write ` operations on Python
29
29
files, buffer allocation on receive operations is automatic, and buffer length
@@ -348,7 +348,7 @@ Constants
348
348
AF_INET6
349
349
350
350
These constants represent the address (and protocol) families, used for the
351
- first argument to :func: `.socket `. If the :const: `AF_UNIX ` constant is not
351
+ first argument to :func: `~socket .socket `. If the :const: `AF_UNIX ` constant is not
352
352
defined then this protocol is unsupported. More constants may be available
353
353
depending on the system.
354
354
@@ -365,7 +365,7 @@ Constants
365
365
SOCK_SEQPACKET
366
366
367
367
These constants represent the socket types, used for the second argument to
368
- :func: `.socket `. More constants may be available depending on the system.
368
+ :func: `~socket .socket `. More constants may be available depending on the system.
369
369
(Only :const: `SOCK_STREAM ` and :const: `SOCK_DGRAM ` appear to be generally
370
370
useful.)
371
371
@@ -404,7 +404,7 @@ Constants
404
404
405
405
Many constants of these forms, documented in the Unix documentation on sockets
406
406
and/or the IP protocol, are also defined in the socket module. They are
407
- generally used in arguments to the :meth: `setsockopt ` and :meth: `getsockopt `
407
+ generally used in arguments to the :meth: `~socket. setsockopt ` and :meth: `~socket. getsockopt `
408
408
methods of socket objects. In most cases, only those symbols that are defined
409
409
in the Unix header files are defined; for a few symbols, default values are
410
410
provided.
@@ -770,7 +770,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
770
770
771
771
Build a pair of connected socket objects using the given address family, socket
772
772
type, and protocol number. Address family, socket type, and protocol number are
773
- as for the :func: `.socket ` function above. The default family is :const: `AF_UNIX `
773
+ as for the :func: `~socket .socket ` function above. The default family is :const: `AF_UNIX `
774
774
if defined on the platform; otherwise, the default is :const: `AF_INET `.
775
775
776
776
The newly created sockets are :ref: `non-inheritable <fd_inheritance >`.
@@ -866,7 +866,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
866
866
867
867
Duplicate the file descriptor *fd * (an integer as returned by a file object's
868
868
:meth: `~io.IOBase.fileno ` method) and build a socket object from the result. Address
869
- family, socket type and protocol number are as for the :func: `.socket ` function
869
+ family, socket type and protocol number are as for the :func: `~socket .socket ` function
870
870
above. The file descriptor should refer to a socket, but this is not checked ---
871
871
subsequent operations on the object may fail if the file descriptor is invalid.
872
872
This function is rarely needed, but can be used to get or set socket options on
@@ -931,7 +931,7 @@ The :mod:`socket` module also offers various network-related services:
931
931
``(family, type, proto, canonname, sockaddr) ``
932
932
933
933
In these tuples, *family *, *type *, *proto * are all integers and are
934
- meant to be passed to the :func: `.socket ` function. *canonname * will be
934
+ meant to be passed to the :func: `~socket .socket ` function. *canonname * will be
935
935
a string representing the canonical name of the *host * if
936
936
:const: `AI_CANONNAME ` is part of the *flags * argument; else *canonname *
937
937
will be empty. *sockaddr * is a tuple describing a socket address, whose
@@ -1047,7 +1047,7 @@ The :mod:`socket` module also offers various network-related services:
1047
1047
.. function :: getprotobyname(protocolname)
1048
1048
1049
1049
Translate an internet protocol name (for example, ``'icmp' ``) to a constant
1050
- suitable for passing as the (optional) third argument to the :func: `.socket `
1050
+ suitable for passing as the (optional) third argument to the :func: `~socket .socket `
1051
1051
function. This is usually only needed for sockets opened in "raw" mode
1052
1052
(:const: `SOCK_RAW `); for the normal socket modes, the correct protocol is chosen
1053
1053
automatically if the protocol is omitted or zero.
@@ -1331,7 +1331,7 @@ The :mod:`socket` module also offers various network-related services:
1331
1331
1332
1332
Send the list of file descriptors *fds * over an :const: `AF_UNIX ` socket *sock *.
1333
1333
The *fds * parameter is a sequence of file descriptors.
1334
- Consult :meth: `sendmsg ` for the documentation of these parameters.
1334
+ Consult :meth: `~socket. sendmsg ` for the documentation of these parameters.
1335
1335
1336
1336
.. availability :: Unix, Windows, not Emscripten, not WASI.
1337
1337
@@ -1345,7 +1345,7 @@ The :mod:`socket` module also offers various network-related services:
1345
1345
1346
1346
Receive up to *maxfds * file descriptors from an :const: `AF_UNIX ` socket *sock *.
1347
1347
Return ``(msg, list(fds), flags, addr) ``.
1348
- Consult :meth: `recvmsg ` for the documentation of these parameters.
1348
+ Consult :meth: `~socket. recvmsg ` for the documentation of these parameters.
1349
1349
1350
1350
.. availability :: Unix, Windows, not Emscripten, not WASI.
1351
1351
@@ -2064,10 +2064,10 @@ Example
2064
2064
2065
2065
Here are four minimal example programs using the TCP/IP protocol: a server that
2066
2066
echoes all data that it receives back (servicing only one client), and a client
2067
- using it. Note that a server must perform the sequence :func: `.socket `,
2067
+ using it. Note that a server must perform the sequence :func: `~socket .socket `,
2068
2068
:meth: `~socket.bind `, :meth: `~socket.listen `, :meth: `~socket.accept ` (possibly
2069
2069
repeating the :meth: `~socket.accept ` to service more than one client), while a
2070
- client only needs the sequence :func: `.socket `, :meth: `~socket.connect `. Also
2070
+ client only needs the sequence :func: `~socket .socket `, :meth: `~socket.connect `. Also
2071
2071
note that the server does not :meth: `~socket.sendall `/:meth: `~socket.recv ` on
2072
2072
the socket it is listening on but on the new socket returned by
2073
2073
:meth: `~socket.accept `.
0 commit comments