WebServer and running code parallel
-
Hi folks
I have implemented a tiny WebServer in Python.
This code fragment is receiving any request to the m5stack device.
conn, addr = s.accept()
request = conn.recv(1024)
request = str(request)Now I have the problem, that the code "conn.recv()" ist waiting for request, but no other code is executing in the meantime.
Does anyone know a trick to run code in "parallel", while conn.recv() is waiting for any request?Thanks very much for help :-)
Thomas -
I've got it.
I can start new threads with:
import _thread as th
th.start_new_thread(....)Cool stuff :-)
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login