uasyncio.start_server: OSError: [Errno 12] ENOMEM when closing server and running it again #14282
Unanswered
SirBlackmore
asked this question in
Using MicroPython
Replies: 1 comment
-
What do you need to achieve? I'd rather not close/release the started server. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm trying to create a program that runs an asynchronous web server while also checking the state of two buttons. When I create the server with asyncio.start_server, it works correctly. The issue is that I would like the activation or deactivation of the web server (and the WiFi access point) to depend on the state of a third button (sw_wifi). That is, when the value of sw_wifi is True, it should activate both the access point and the server, and when it is False, it should deactivate both.
The problem is that when I activate and then deactivate it, it works fine. But when I activate it for the second time, it always gives me an error:
It seems that the issue is that it's creating another server without closing the first one, which is why it runs out of memory, even though I'm using:
Is it possible to close it and free memory so that I can create the server again when I press the sw_wifi button again?
If I add await server.wait_closed() after server.close(), it doesn't work; it's as if it skips that function, and it never sets the variable ap_active to False.
If anyone can help me, I would greatly appreciate it.
Here's my code (I've omitted parts that are unrelated to my problem):
Beta Was this translation helpful? Give feedback.
All reactions