summaryrefslogtreecommitdiffstats
path: root/Doc/library/socket.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-01-03 21:18:54 (GMT)
committerGeorg Brandl <georg@python.org>2009-01-03 21:18:54 (GMT)
commit48310cd3f2e02ced9ae836ccbcb67e9af3097d62 (patch)
tree04c86b387c11bfd4835a320e76bbb2ee24626e0d /Doc/library/socket.rst
parent3d3558a4653fcfcbdcbb75bda5d61e93c48f4d51 (diff)
downloadcpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.zip
cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.tar.gz
cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.tar.bz2
Remove trailing whitespace.
Diffstat (limited to 'Doc/library/socket.rst')
-rw-r--r--Doc/library/socket.rst26
1 files changed, 13 insertions, 13 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 536b3c5..c2e3d91 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -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)