diff --git a/adafruit_wiznet5k/adafruit_wiznet5k_socket.py b/adafruit_wiznet5k/adafruit_wiznet5k_socket.py index 5626592..8846b0d 100644 --- a/adafruit_wiznet5k/adafruit_wiznet5k_socket.py +++ b/adafruit_wiznet5k/adafruit_wiznet5k_socket.py @@ -27,6 +27,7 @@ import gc import time from sys import byteorder +from errno import ETIMEDOUT from micropython import const @@ -400,6 +401,7 @@ def accept( while self._status not in ( wiznet5k.adafruit_wiznet5k.SNSR_SOCK_SYNRECV, wiznet5k.adafruit_wiznet5k.SNSR_SOCK_ESTABLISHED, + wiznet5k.adafruit_wiznet5k.SNSR_SOCK_LISTEN, ): if self._timeout and 0 < self._timeout < time.monotonic() - stamp: raise TimeoutError("Failed to accept connection.") @@ -772,7 +774,7 @@ class timeout(TimeoutError): the timeout has elapsed and we haven't received any data yet.""" def __init__(self, msg): - super().__init__(msg) + super().__init__(ETIMEDOUT, msg) # pylint: enable=unused-argument, redefined-builtin, invalid-name