@@ -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
@@ -322,7 +322,7 @@ Constants
322
322
AF_INET6
323
323
324
324
These constants represent the address (and protocol) families, used for the
325
- first argument to :func: `.socket `. If the :const: `AF_UNIX ` constant is not
325
+ first argument to :func: `~socket .socket `. If the :const: `AF_UNIX ` constant is not
326
326
defined then this protocol is unsupported. More constants may be available
327
327
depending on the system.
328
328
@@ -339,7 +339,7 @@ Constants
339
339
SOCK_SEQPACKET
340
340
341
341
These constants represent the socket types, used for the second argument to
342
- :func: `.socket `. More constants may be available depending on the system.
342
+ :func: `~socket .socket `. More constants may be available depending on the system.
343
343
(Only :const: `SOCK_STREAM ` and :const: `SOCK_DGRAM ` appear to be generally
344
344
useful.)
345
345
@@ -378,7 +378,7 @@ Constants
378
378
379
379
Many constants of these forms, documented in the Unix documentation on sockets
380
380
and/or the IP protocol, are also defined in the socket module. They are
381
- generally used in arguments to the :meth: `setsockopt ` and :meth: `getsockopt `
381
+ generally used in arguments to the :meth: `~socket. setsockopt ` and :meth: `~socket. getsockopt `
382
382
methods of socket objects. In most cases, only those symbols that are defined
383
383
in the Unix header files are defined; for a few symbols, default values are
384
384
provided.
@@ -671,7 +671,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
671
671
672
672
Build a pair of connected socket objects using the given address family, socket
673
673
type, and protocol number. Address family, socket type, and protocol number are
674
- as for the :func: `.socket ` function above. The default family is :const: `AF_UNIX `
674
+ as for the :func: `~socket .socket ` function above. The default family is :const: `AF_UNIX `
675
675
if defined on the platform; otherwise, the default is :const: `AF_INET `.
676
676
677
677
The newly created sockets are :ref: `non-inheritable <fd_inheritance >`.
@@ -767,7 +767,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
767
767
768
768
Duplicate the file descriptor *fd * (an integer as returned by a file object's
769
769
:meth: `~io.IOBase.fileno ` method) and build a socket object from the result. Address
770
- family, socket type and protocol number are as for the :func: `.socket ` function
770
+ family, socket type and protocol number are as for the :func: `~socket .socket ` function
771
771
above. The file descriptor should refer to a socket, but this is not checked ---
772
772
subsequent operations on the object may fail if the file descriptor is invalid.
773
773
This function is rarely needed, but can be used to get or set socket options on
@@ -832,7 +832,7 @@ The :mod:`socket` module also offers various network-related services:
832
832
``(family, type, proto, canonname, sockaddr) ``
833
833
834
834
In these tuples, *family *, *type *, *proto * are all integers and are
835
- meant to be passed to the :func: `.socket ` function. *canonname * will be
835
+ meant to be passed to the :func: `~socket .socket ` function. *canonname * will be
836
836
a string representing the canonical name of the *host * if
837
837
:const: `AI_CANONNAME ` is part of the *flags * argument; else *canonname *
838
838
will be empty. *sockaddr * is a tuple describing a socket address, whose
@@ -948,7 +948,7 @@ The :mod:`socket` module also offers various network-related services:
948
948
.. function :: getprotobyname(protocolname)
949
949
950
950
Translate an internet protocol name (for example, ``'icmp' ``) to a constant
951
- suitable for passing as the (optional) third argument to the :func: `.socket `
951
+ suitable for passing as the (optional) third argument to the :func: `~socket .socket `
952
952
function. This is usually only needed for sockets opened in "raw" mode
953
953
(:const: `SOCK_RAW `); for the normal socket modes, the correct protocol is chosen
954
954
automatically if the protocol is omitted or zero.
@@ -1232,7 +1232,7 @@ The :mod:`socket` module also offers various network-related services:
1232
1232
1233
1233
Send the list of file descriptors *fds * over an :const: `AF_UNIX ` socket *sock *.
1234
1234
The *fds * parameter is a sequence of file descriptors.
1235
- Consult :meth: `sendmsg ` for the documentation of these parameters.
1235
+ Consult :meth: `~socket. sendmsg ` for the documentation of these parameters.
1236
1236
1237
1237
.. availability :: Unix, Windows, not Emscripten, not WASI.
1238
1238
@@ -1246,7 +1246,7 @@ The :mod:`socket` module also offers various network-related services:
1246
1246
1247
1247
Receive up to *maxfds * file descriptors from an :const: `AF_UNIX ` socket *sock *.
1248
1248
Return ``(msg, list(fds), flags, addr) ``.
1249
- Consult :meth: `recvmsg ` for the documentation of these parameters.
1249
+ Consult :meth: `~socket. recvmsg ` for the documentation of these parameters.
1250
1250
1251
1251
.. availability :: Unix, Windows, not Emscripten, not WASI.
1252
1252
@@ -1965,10 +1965,10 @@ Example
1965
1965
1966
1966
Here are four minimal example programs using the TCP/IP protocol: a server that
1967
1967
echoes all data that it receives back (servicing only one client), and a client
1968
- using it. Note that a server must perform the sequence :func: `.socket `,
1968
+ using it. Note that a server must perform the sequence :func: `~socket .socket `,
1969
1969
:meth: `~socket.bind `, :meth: `~socket.listen `, :meth: `~socket.accept ` (possibly
1970
1970
repeating the :meth: `~socket.accept ` to service more than one client), while a
1971
- client only needs the sequence :func: `.socket `, :meth: `~socket.connect `. Also
1971
+ client only needs the sequence :func: `~socket .socket `, :meth: `~socket.connect `. Also
1972
1972
note that the server does not :meth: `~socket.sendall `/:meth: `~socket.recv ` on
1973
1973
the socket it is listening on but on the new socket returned by
1974
1974
:meth: `~socket.accept `.
0 commit comments