From 376edc47be362f6c2e523ae336c078dc75ab6531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sat, 26 Mar 2022 20:34:20 +0100 Subject: [PATCH] trying to run socket in background --- main.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index a0f2655..aa04fab 100644 --- a/main.py +++ b/main.py @@ -100,15 +100,15 @@ if __name__ == '__main__': GPIO.add_event_detect(13, GPIO.RISING, callback=power_toggle, bouncetime=300) GPIO.add_event_detect(19, GPIO.RISING, callback=change_idle_mode, bouncetime=300) - # with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: - # s.bind((SOCKET_BIND_IP, SOCKET_BIND_PORT)) - # s.listen() - # conn, addr = s.accept() + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + s.bind((SOCKET_BIND_IP, SOCKET_BIND_PORT)) + s.listen(1) + conn, addr = s.accept() try: while True: - # socket_data = conn.recv(1024) - # print(socket_data) - # print(type(socket_data)) + socket_data = conn.recv(1024) + print(socket_data) + print(type(socket_data)) if led_power == True: if check_internet() == False: blink(strip, Color(255,0,0), Color(255,255,255))