*happy_eyeballs_delay*, *interleave*
and *local_addr* should be specified.
+ .. note::
+
+ The *sock* argument transfers ownership of the socket to the
+ transport created. To close the socket, call the transport's
+ :meth:`~asyncio.BaseTransport.close` method.
+
* *local_addr*, if given, is a ``(local_host, local_port)`` tuple used
to bind the socket locally. The *local_host* and *local_port*
are looked up using ``getaddrinfo()``, similarly to *host* and *port*.
transport. If specified, *local_addr* and *remote_addr* should be omitted
(must be :const:`None`).
+ .. note::
+
+ The *sock* argument transfers ownership of the socket to the
+ transport created. To close the socket, call the transport's
+ :meth:`~asyncio.BaseTransport.close` method.
+
See :ref:`UDP echo client protocol <asyncio-udp-echo-client-protocol>` and
:ref:`UDP echo server protocol <asyncio-udp-echo-server-protocol>` examples.
* *sock* can optionally be specified in order to use a preexisting
socket object. If specified, *host* and *port* must not be specified.
+ .. note::
+
+ The *sock* argument transfers ownership of the socket to the
+ server created. To close the socket, call the server's
+ :meth:`~asyncio.Server.close` method.
+
* *backlog* is the maximum number of queued connections passed to
:meth:`~socket.socket.listen` (defaults to 100).
* *sock* is a preexisting socket object returned from
:meth:`socket.accept <socket.socket.accept>`.
+ .. note::
+
+ The *sock* argument transfers ownership of the socket to the
+ transport created. To close the socket, call the transport's
+ :meth:`~asyncio.BaseTransport.close` method.
+
* *ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over
the accepted connections.
The rest of the arguments are passed directly to
:meth:`loop.create_connection`.
+ .. note::
+
+ The *sock* argument transfers ownership of the socket to the
+ :class:`StreamWriter` created. To close the socket, call its
+ :meth:`~asyncio.StreamWriter.close` method.
+
.. versionchanged:: 3.7
Added the *ssl_handshake_timeout* parameter.
The rest of the arguments are passed directly to
:meth:`loop.create_server`.
+ .. note::
+
+ The *sock* argument transfers ownership of the socket to the
+ server created. To close the socket, call the server's
+ :meth:`~asyncio.Server.close` method.
+
.. versionchanged:: 3.7
Added the *ssl_handshake_timeout* and *start_serving* parameters.
See also the documentation of :meth:`loop.create_unix_connection`.
+ .. note::
+
+ The *sock* argument transfers ownership of the socket to the
+ :class:`StreamWriter` created. To close the socket, call its
+ :meth:`~asyncio.StreamWriter.close` method.
+
.. availability:: Unix.
.. versionchanged:: 3.7
See also the documentation of :meth:`loop.create_unix_server`.
+ .. note::
+
+ The *sock* argument transfers ownership of the socket to the
+ server created. To close the socket, call the server's
+ :meth:`~asyncio.Server.close` method.
+
.. availability:: Unix.
.. versionchanged:: 3.7