Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CircuitPython 9.0.0 will require SO.REUSEADDR for socket reuse #83

Closed
dhalbert opened this issue Feb 17, 2024 · 1 comment · Fixed by #84
Closed

CircuitPython 9.0.0 will require SO.REUSEADDR for socket reuse #83

dhalbert opened this issue Feb 17, 2024 · 1 comment · Fixed by #84

Comments

@dhalbert
Copy link
Contributor

CircuitPython 9.0.0-beta.1 will include this PR:

This makes the semantics of socket reuse as it is in CPython. One would need to use socket.setsockopt(pool.SOL_SOCKET, pool.SO_REUSEADDR, 1) in the same cases one would use it in CPython.

HTTPServer maintainers: Is this a breaking change for use of adafruit_httpserver or for the examples? Thanks for looking.

@michalpokusa
Copy link
Contributor

Tested on ESP32-S2 with lates adafruit_httpserver and CP 9.0.0-beta.1.

Indeed starting the server, Ctrl-C'ing and Ctrl-D'ing results in EADDRINUSE. Modyfying code lib code so it calls the line you provided solves the problem.

Changing the port to different one and re-launching the code works too, but this is more of a hack than solution.

image

One thing I noticed is that the error is also present when trying to use port 80, probably because web workflow uses it too. It was possible to use this port before, so examples would have to be cahnged to use e.g. 8000. I can change them and add note to docs about this behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants