diff --git a/main.py b/main.py index caabe8d..2b1df0d 100644 --- a/main.py +++ b/main.py @@ -99,9 +99,7 @@ def socket_listener(): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((SOCKET_BIND_IP, SOCKET_BIND_PORT)) s.listen() - global conn - global addr - conn, addr = s.accept() + return s.accept() if __name__ == '__main__': strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL) @@ -116,6 +114,7 @@ if __name__ == '__main__': try: while True: + conn, addr = socket_listener() socket_data = conn.recv(1024) print(socket_data) print(type(socket_data))