Added socket threading
parent
36ddcad9c5
commit
167ef97546
8
main.py
8
main.py
|
@ -98,7 +98,7 @@ def power_toggle(channel):
|
||||||
def socket_listener():
|
def socket_listener():
|
||||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||||
s.bind((SOCKET_BIND_IP, SOCKET_BIND_PORT))
|
s.bind((SOCKET_BIND_IP, SOCKET_BIND_PORT))
|
||||||
s.listen(1)
|
s.listen()
|
||||||
global conn
|
global conn
|
||||||
global addr
|
global addr
|
||||||
conn, addr = s.accept()
|
conn, addr = s.accept()
|
||||||
|
@ -116,9 +116,9 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
# socket_data = conn.recv(1024)
|
socket_data = conn.recv(1024)
|
||||||
# print(socket_data)
|
print(socket_data)
|
||||||
# print(type(socket_data))
|
print(type(socket_data))
|
||||||
if led_power == True:
|
if led_power == True:
|
||||||
if check_internet() == False:
|
if check_internet() == False:
|
||||||
blink(strip, Color(255,0,0), Color(255,255,255))
|
blink(strip, Color(255,0,0), Color(255,255,255))
|
||||||
|
|
Loading…
Reference in New Issue