summaryrefslogtreecommitdiff
path: root/Doc/library/asyncio-eventloop.rst
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2015-10-05 09:19:11 -0700
committerGuido van Rossum <guido@python.org>2015-10-05 09:19:11 -0700
commitc9470fd344cafed40ae97f5d332e9f41108ba82a (patch)
treeb34a4fe638366fa9d04f7849371d66341237c920 /Doc/library/asyncio-eventloop.rst
parent1b4f788265859090564d4cd62b5a8d35c3e819c0 (diff)
parent6a291ad48fe2d792049c886a2aaed0abf525eb33 (diff)
downloadcpython-c9470fd344cafed40ae97f5d332e9f41108ba82a.tar.gz
Issue #23972: updates to asyncio datagram API. By Chris Laws. (Merge 3.4->3.5.)
Diffstat (limited to 'Doc/library/asyncio-eventloop.rst')
-rw-r--r--Doc/library/asyncio-eventloop.rst46
1 files changed, 42 insertions, 4 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index 1de5f7beaf..279bc29636 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -285,17 +285,50 @@ Creating connections
(:class:`StreamReader`, :class:`StreamWriter`) instead of a protocol.
-.. coroutinemethod:: BaseEventLoop.create_datagram_endpoint(protocol_factory, local_addr=None, remote_addr=None, \*, family=0, proto=0, flags=0)
+.. coroutinemethod:: BaseEventLoop.create_datagram_endpoint(protocol_factory, local_addr=None, remote_addr=None, \*, family=0, proto=0, flags=0, reuse_address=None, reuse_port=None, allow_broadcast=None, sock=None)
Create datagram connection: socket family :py:data:`~socket.AF_INET` or
:py:data:`~socket.AF_INET6` depending on *host* (or *family* if specified),
- socket type :py:data:`~socket.SOCK_DGRAM`.
+ socket type :py:data:`~socket.SOCK_DGRAM`. *protocol_factory* must be a
+ callable returning a :ref:`protocol <asyncio-protocol>` instance.
This method is a :ref:`coroutine <coroutine>` which will try to
establish the connection in the background. When successful, the
coroutine returns a ``(transport, protocol)`` pair.
- See the :meth:`BaseEventLoop.create_connection` method for parameters.
+ Options changing how the connection is created:
+
+ * *local_addr*, if given, is a ``(local_host, local_port)`` tuple used
+ to bind the socket to locally. The *local_host* and *local_port*
+ are looked up using :meth:`getaddrinfo`.
+
+ * *remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used
+ to connect the socket to a remote address. The *remote_host* and
+ *remote_port* are looked up using :meth:`getaddrinfo`.
+
+ * *family*, *proto*, *flags* are the optional address family, protocol
+ and flags to be passed through to :meth:`getaddrinfo` for *host*
+ resolution. If given, these should all be integers from the
+ corresponding :mod:`socket` module constants.
+
+ * *reuse_address* tells the kernel to reuse a local socket in
+ TIME_WAIT state, without waiting for its natural timeout to
+ expire. If not specified will automatically be set to True on
+ UNIX.
+
+ * *reuse_port* tells the kernel to allow this endpoint to be bound to the
+ same port as other existing endpoints are bound to, so long as they all
+ set this flag when being created. This option is not supported on Windows
+ and some UNIX's. If the :py:data:`~socket.SO_REUSEPORT` constant is not
+ defined then this capability is unsupported.
+
+ * *allow_broadcast* tells the kernel to allow this endpoint to send
+ messages to the broadcast address.
+
+ * *sock* can optionally be specified in order to use a preexisting,
+ already connected, :class:`socket.socket` object to be used by the
+ transport. If specified, *local_addr* and *remote_addr* should be omitted
+ (must be :const:`None`).
On Windows with :class:`ProactorEventLoop`, this method is not supported.
@@ -322,7 +355,7 @@ Creating connections
Creating listening connections
------------------------------
-.. coroutinemethod:: BaseEventLoop.create_server(protocol_factory, host=None, port=None, \*, family=socket.AF_UNSPEC, flags=socket.AI_PASSIVE, sock=None, backlog=100, ssl=None, reuse_address=None)
+.. coroutinemethod:: BaseEventLoop.create_server(protocol_factory, host=None, port=None, \*, family=socket.AF_UNSPEC, flags=socket.AI_PASSIVE, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None)
Create a TCP server (socket type :data:`~socket.SOCK_STREAM`) bound to
*host* and *port*.
@@ -361,6 +394,11 @@ Creating listening connections
expire. If not specified will automatically be set to True on
UNIX.
+ * *reuse_port* tells the kernel to allow this endpoint to be bound to the
+ same port as other existing endpoints are bound to, so long as they all
+ set this flag when being created. This option is not supported on
+ Windows.
+
This method is a :ref:`coroutine <coroutine>`.
.. versionchanged:: 3.5