Hi deltav,
If you move the s.setblocking(False) line to after the w.connect call, the example should work fine. Or, you could change it to:
import uerrno
while True: # TODO time out eventually?
try:
w.connect((aws_endpoint, 8443))
break
except OSError as e:
if e.args[0] != uerrno.EINPROGRESS:
raise
(I apologize, I cannot format this code with correct indentation. Hopefully you can tell what it's meant to be.)
We will work on updating the sample code to reflect the fact that if you use s.setblocking(False) before calling connect, you must call connect in a loop and continue calling connect until it stops raising OSError EINPROGRESS.
The sample code you are using was not updated after the 1016 firmware was released, which is when support for nonblocking socket connects was added. (In earlier firmware, the connect call would block there.)