extmod/uasyncio: In open_connection use address info in socket creation.

Rudimentary support for various address families.

Signed-off-by: oclyke <oclyke@gmail.com>
This commit is contained in:
oclyke 2021-07-22 17:42:30 -06:00 committed by Damien George
parent 40b8ff0a6f
commit e29259d171
1 changed files with 2 additions and 2 deletions

View File

@ -79,8 +79,8 @@ async def open_connection(host, port):
from uerrno import EINPROGRESS from uerrno import EINPROGRESS
import usocket as socket import usocket as socket
ai = socket.getaddrinfo(host, port)[0] # TODO this is blocking! ai = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0] # TODO this is blocking!
s = socket.socket() s = socket.socket(ai[0], ai[1], ai[2])
s.setblocking(False) s.setblocking(False)
ss = Stream(s) ss = Stream(s)
try: try: