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 :-)
-