mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Remove trailing whitespace.
This commit is contained in:
parent
3d3558a465
commit
48310cd3f2
127 changed files with 825 additions and 825 deletions
|
@ -178,10 +178,10 @@ The module :mod:`socket` exports the following constants and functions:
|
|||
|
||||
.. data:: SIO_*
|
||||
RCVALL_*
|
||||
|
||||
|
||||
Constants for Windows' WSAIoctl(). The constants are used as arguments to the
|
||||
:meth:`ioctl` method of socket objects.
|
||||
|
||||
|
||||
|
||||
.. data:: TIPC_*
|
||||
|
||||
|
@ -210,7 +210,7 @@ The module :mod:`socket` exports the following constants and functions:
|
|||
all the necessary arguments for creating the corresponding socket. *host* is a domain
|
||||
name, a string representation of an IPv4/v6 address or ``None``. *port* is a string
|
||||
service name such as ``'http'``, a numeric port number or ``None``.
|
||||
The rest of the arguments are optional and must be numeric if specified.
|
||||
The rest of the arguments are optional and must be numeric if specified.
|
||||
By passing ``None`` as the value of *host* and *port*, , you can pass ``NULL`` to the C API.
|
||||
|
||||
The :func:`getaddrinfo` function returns a list of 5-tuples with the following
|
||||
|
@ -544,14 +544,14 @@ correspond to Unix system calls applicable to sockets.
|
|||
contents of the buffer (see the optional built-in module :mod:`struct` for a way
|
||||
to decode C structures encoded as byte strings).
|
||||
|
||||
|
||||
|
||||
.. method:: socket.ioctl(control, option)
|
||||
|
||||
:platform: Windows
|
||||
|
||||
:platform: Windows
|
||||
|
||||
The :meth:`ioctl` method is a limited interface to the WSAIoctl system
|
||||
interface. Please refer to the MSDN documentation for more information.
|
||||
|
||||
|
||||
|
||||
.. method:: socket.listen(backlog)
|
||||
|
||||
|
@ -851,7 +851,7 @@ sends traffic to the first one connected successfully. ::
|
|||
s.close()
|
||||
print('Received', repr(data))
|
||||
|
||||
|
||||
|
||||
The last example shows how to write a very simple network sniffer with raw
|
||||
sockets on Windows. The example requires administrator privileges to modify
|
||||
the interface::
|
||||
|
@ -860,19 +860,19 @@ the interface::
|
|||
|
||||
# the public network interface
|
||||
HOST = socket.gethostbyname(socket.gethostname())
|
||||
|
||||
|
||||
# create a raw socket and bind it to the public interface
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
|
||||
s.bind((HOST, 0))
|
||||
|
||||
|
||||
# Include IP headers
|
||||
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
|
||||
|
||||
|
||||
# receive all packages
|
||||
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
|
||||
|
||||
|
||||
# receive a package
|
||||
print(s.recvfrom(65565))
|
||||
|
||||
|
||||
# disabled promiscuous mode
|
||||
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue