summaryrefslogtreecommitdiffstats
path: root/Doc/library/asyncio-stream.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/asyncio-stream.rst')
-rw-r--r--Doc/library/asyncio-stream.rst7
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst
index 9db2380..c3bbd20 100644
--- a/Doc/library/asyncio-stream.rst
+++ b/Doc/library/asyncio-stream.rst
@@ -296,11 +296,14 @@ Coroutine waiting until a socket receives data using the
:func:`open_connection` function::
import asyncio
- import socket
+ try:
+ from socket import socketpair
+ except ImportError:
+ from asyncio.windows_utils import socketpair
def wait_for_data(loop):
# Create a pair of connected sockets
- rsock, wsock = socket.socketpair()
+ rsock, wsock = socketpair()
# Register the open socket to wait for data
reader, writer = yield from asyncio.open_connection(sock=rsock, loop=loop)