@@ -90,8 +90,9 @@ All errors raise exceptions. The normal exceptions for invalid argument types
9090and out-of-memory conditions can be raised; errors related to socket or address
9191semantics raise the error :exc: `socket.error `.
9292
93- Non-blocking mode is supported through :meth: `setblocking `. A generalization of
94- this based on timeouts is supported through :meth: `settimeout `.
93+ Non-blocking mode is supported through :meth: `~socket.setblocking `. A
94+ generalization of this based on timeouts is supported through
95+ :meth: `~socket.settimeout `.
9596
9697The module :mod: `socket ` exports the following constants and functions:
9798
@@ -553,7 +554,9 @@ correspond to Unix system calls applicable to sockets.
553554 :platform: Windows
554555
555556 The :meth: `ioctl ` method is a limited interface to the WSAIoctl system
556- interface. Please refer to the MSDN documentation for more information.
557+ interface. Please refer to the `Win32 documentation
558+ <http://msdn.microsoft.com/en-us/library/ms741621%28VS.85%29.aspx> `_ for more
559+ information.
557560
558561 On other platforms, the generic :func: `fcntl.fcntl ` and :func: `fcntl.ioctl `
559562 functions may be used; they accept a socket object as their first argument.
@@ -656,7 +659,7 @@ correspond to Unix system calls applicable to sockets.
656659 blocking mode. In non-blocking mode, if a :meth: `recv ` call doesn't find any
657660 data, or if a :meth: `send ` call can't immediately dispose of the data, a
658661 :exc: `error ` exception is raised; in blocking mode, the calls block until they
659- can proceed. ``s.setblocking(0) `` is equivalent to ``s.settimeout(0) ``;
662+ can proceed. ``s.setblocking(0) `` is equivalent to ``s.settimeout(0.0 ) ``;
660663 ``s.setblocking(1) `` is equivalent to ``s.settimeout(None) ``.
661664
662665
@@ -685,21 +688,21 @@ the system returns an error (such as connection timed out). In
685688non-blocking mode, operations fail (with an error that is unfortunately
686689system-dependent) if they cannot be completed immediately. In timeout mode,
687690operations fail if they cannot be completed within the timeout specified for the
688- socket or if the system returns an error. The :meth: `setblocking ` method is simply
689- a shorthand for certain :meth: `settimeout ` calls.
691+ socket or if the system returns an error. The :meth: `~socket. setblocking `
692+ method is simply a shorthand for certain :meth: `~socket. settimeout ` calls.
690693
691694Timeout mode internally sets the socket in non-blocking mode. The blocking and
692695timeout modes are shared between file descriptors and socket objects that refer
693696to the same network endpoint. A consequence of this is that file objects
694- returned by the :meth: `makefile ` method must only be used when the socket is in
695- blocking mode; in timeout or non-blocking mode file operations that cannot be
696- completed immediately will fail.
697+ returned by the :meth: `~socket. makefile ` method must only be used when the
698+ socket is in blocking mode; in timeout or non-blocking mode file operations
699+ that cannot be completed immediately will fail.
697700
698- Note that the :meth: `connect ` operation is subject to the timeout setting, and
699- in general it is recommended to call :meth: `settimeout ` before calling
700- :meth: `connect ` or pass a timeout parameter to :meth: ` create_connection `.
701- The system network stack may return a connection timeout error
702- of its own regardless of any Python socket timeout setting.
701+ Note that the :meth: `~socket. connect ` operation is subject to the timeout
702+ setting, and in general it is recommended to call :meth: `~socket. settimeout `
703+ before calling :meth: `~socket. connect ` or pass a timeout parameter to
704+ :meth: ` create_connection `. The system network stack may return a connection
705+ timeout error of its own regardless of any Python socket timeout setting.
703706
704707
705708.. method :: socket.setsockopt(level, optname, value)
@@ -721,8 +724,8 @@ of its own regardless of any Python socket timeout setting.
721724 are disallowed. If *how * is :const: `SHUT_RDWR `, further sends and receives are
722725 disallowed.
723726
724- Note that there are no methods :meth: `read ` or :meth: `write `; use :meth: ` recv `
725- and :meth: `send ` without *flags * argument instead.
727+ Note that there are no methods :meth: `read ` or :meth: `write `; use
728+ :meth: ` ~socket.recv ` and :meth: `~socket. send ` without *flags * argument instead.
726729
727730Socket objects also have these (read-only) attributes that correspond to the
728731values given to the :class: `socket ` constructor.
@@ -751,11 +754,12 @@ Example
751754Here are four minimal example programs using the TCP/IP protocol: a server that
752755echoes all data that it receives back (servicing only one client), and a client
753756using it. Note that a server must perform the sequence :func: `socket `,
754- :meth: `bind `, :meth: `listen `, :meth: `accept ` (possibly repeating the
755- :meth: `accept ` to service more than one client), while a client only needs the
756- sequence :func: `socket `, :meth: `connect `. Also note that the server does not
757- :meth: `send `/:meth: `recv ` on the socket it is listening on but on the new
758- socket returned by :meth: `accept `.
757+ :meth: `~socket.bind `, :meth: `~socket.listen `, :meth: `~socket.accept ` (possibly
758+ repeating the :meth: `~socket.accept ` to service more than one client), while a
759+ client only needs the sequence :func: `socket `, :meth: `~socket.connect `. Also
760+ note that the server does not :meth: `~socket.send `/:meth: `~socket.recv ` on the
761+ socket it is listening on but on the new socket returned by
762+ :meth: `~socket.accept `.
759763
760764The first two examples support IPv4 only. ::
761765
0 commit comments