🤖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

    Scheduled Pinned Locked Moved SOFTWARE
    3 Posts 1 Posters 6.6k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          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
          • First post
            Last post