adafruit / Adafruit_CircuitPython_Wiznet5k

Pure-Python interface for WIZNET 5k Ethernet modules
Other
15 stars 35 forks source link

AttributeError: 'socket' object has no attribute 'setsockopt' (TLS) #155

Closed anecdata closed 4 months ago

anecdata commented 5 months ago

When trying to set up a TLS TCP server on WIZnet using https://github.com/adafruit/circuitpython/pull/8954 + https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k/tree/core-compatible-socket-type-numbers

ss = ssl_context.wrap_socket(s, server_side=True) results in AttributeError: 'socket' object has no attribute 'setsockopt'

anecdata commented 5 months ago

Looks like this applies to TLS clients now too. sockopt was implemented in https://github.com/adafruit/circuitpython/pull/8954/commits/e5f0579d6c63c788206daf86b4faa1476d8824ed on 3/25, but the 3/21 artifacts will still run TLS clients on WIZnet: https://github.com/adafruit/circuitpython/actions/runs/8380440828

But something else is going on with TLS server using 3/21 artifacts:

Accepting connections (mem=1977744)
Traceback (most recent call last):
  File "code.py", line 63, in <module>
OSError: [Errno 22] Invalid argument

Code done running.
MemoryError: 
MemoryError: 

Press any key to enter the REPL. Use CTRL-D to reload.

line 63 is the accept():

    print(f"Accepting connections (mem={gc.mem_free()})")
    conn, addr = ss.accept()