🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    WebServer and running code parallel

    SOFTWARE
    1
    3
    5.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M5StickFreaklerM
      M5StickFreakler
      last edited by

      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

      M5StickFreaklerM 1 Reply Last reply Reply Quote 0
      • M5StickFreaklerM
        M5StickFreakler @M5StickFreakler
        last edited by

        I've got it.

        I can start new threads with:

        import _thread as th
        th.start_new_thread(....)

        Cool stuff :-)

        1 Reply Last reply Reply Quote 1
        • M5StickFreaklerM
          M5StickFreakler
          last edited by

          look also here:

          http://community.m5stack.com/topic/1722/tiny-webserver-crashes-after-some-hours

          1 Reply Last reply Reply Quote 0
          • First post
            Last post