From e29259d171300b9b8de81c736f717ba6de9c8253 Mon Sep 17 00:00:00 2001 From: oclyke Date: Thu, 22 Jul 2021 17:42:30 -0600 Subject: [PATCH] extmod/uasyncio: In open_connection use address info in socket creation. Rudimentary support for various address families. Signed-off-by: oclyke --- extmod/uasyncio/stream.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extmod/uasyncio/stream.py b/extmod/uasyncio/stream.py index 8de2d2599f..af3b8feab3 100644 --- a/extmod/uasyncio/stream.py +++ b/extmod/uasyncio/stream.py @@ -79,8 +79,8 @@ async def open_connection(host, port): from uerrno import EINPROGRESS import usocket as socket - ai = socket.getaddrinfo(host, port)[0] # TODO this is blocking! - s = socket.socket() + ai = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0] # TODO this is blocking! + s = socket.socket(ai[0], ai[1], ai[2]) s.setblocking(False) ss = Stream(s) try: