Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4505

Beginners • How can i run endless loop, and in the same time run the code after endless loop?

$
0
0
So i have a loop like this on my raspberry pi pico w with micro python, I'm using it to run a server

Code:

    while True:        try:            cl, addr = s.accept()            clientIP = addr[0]                        response = html % str(clientIP)            cl.send('HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n')            cl.send(response)            cl.close()                except OSError as e:            cl.close()            print('conection closed')
How can i have the server up constantly, but in the same time run diferent code.

Statistics: Posted by fepi — Fri Apr 26, 2024 1:06 pm — Replies 7 — Views 70



Viewing all articles
Browse latest Browse all 4505

Trending Articles