@@ -456,6 +456,12 @@ Opening network connections
456
456
*happy_eyeballs_delay *, *interleave *
457
457
and *local_addr * should be specified.
458
458
459
+ .. note ::
460
+
461
+ The *sock * argument transfers ownership of the socket to the
462
+ transport created. To close the socket, call the transport's
463
+ :meth: `~asyncio.BaseTransport.close ` method.
464
+
459
465
* *local_addr *, if given, is a ``(local_host, local_port) `` tuple used
460
466
to bind the socket locally. The *local_host * and *local_port *
461
467
are looked up using ``getaddrinfo() ``, similarly to *host * and *port *.
@@ -554,6 +560,12 @@ Opening network connections
554
560
transport. If specified, *local_addr * and *remote_addr * should be omitted
555
561
(must be :const: `None `).
556
562
563
+ .. note ::
564
+
565
+ The *sock * argument transfers ownership of the socket to the
566
+ transport created. To close the socket, call the transport's
567
+ :meth: `~asyncio.BaseTransport.close ` method.
568
+
557
569
See :ref: `UDP echo client protocol <asyncio-udp-echo-client-protocol >` and
558
570
:ref: `UDP echo server protocol <asyncio-udp-echo-server-protocol >` examples.
559
571
@@ -665,6 +677,12 @@ Creating network servers
665
677
* *sock * can optionally be specified in order to use a preexisting
666
678
socket object. If specified, *host * and *port * must not be specified.
667
679
680
+ .. note ::
681
+
682
+ The *sock * argument transfers ownership of the socket to the
683
+ server created. To close the socket, call the server's
684
+ :meth: `~asyncio.Server.close ` method.
685
+
668
686
* *backlog * is the maximum number of queued connections passed to
669
687
:meth: `~socket.socket.listen ` (defaults to 100).
670
688
@@ -766,6 +784,12 @@ Creating network servers
766
784
* *sock * is a preexisting socket object returned from
767
785
:meth: `socket.accept <socket.socket.accept> `.
768
786
787
+ .. note ::
788
+
789
+ The *sock * argument transfers ownership of the socket to the
790
+ transport created. To close the socket, call the transport's
791
+ :meth: `~asyncio.BaseTransport.close ` method.
792
+
769
793
* *ssl * can be set to an :class: `~ssl.SSLContext ` to enable SSL over
770
794
the accepted connections.
771
795
0 commit comments